title: How can I mock requests and the response?
body: <p>I am trying to use <a href="http://www.voidspace.org.uk/python/mock" rel="noreferrer">Pythons mock package</a> to mock Pythons <code>requests</code> module. What are the basic calls to get me working in below scenario?</p>
  
  <p>In my views.py, I have a function that makes variety of requests.get() calls with different response each time</p>
  
  <pre><code>def myview(request):
    res1 = requests.get('aurl')
    res2 = request.get('burl')
    res3 = request.get('curl')
  </code></pre>
  
  <p>In my test class I want to do something like this but cannot figure out exact method calls</p>
  
  <p>Step 1:</p>
  
  <pre><code># Mock the requests module
  # when mockedRequests.get('aurl') is called then return 'a response'
  # when mockedRequests.get('burl') is called then return 'b response'
  # when mockedRequests.get('curl') is called then return 'c response'
  </code></pre>
  
  <p>Step 2:</p>
  
  <p>Call my view</p>
  
  <p>Step 3: </p>
  
  <p>verify response contains 'a response', 'b response' , 'c response'</p>
  
  <p>How can I complete Step 1 (mocking the requests module)?</p>