title: Unit-testing python-requests?
body: <p>I have a couple methods I'd like to unit test which use the Python <code>requests</code> library. Essentially, they're doing something like this:</p>
  
  <pre><code>def my_method_under_test(self):
      r = requests.get("https://ec2.amazonaws.com/", params={'Action': 'GetConsoleOutput',
              'InstanceId': 'i-123456'})
      # do other stuffs
  </code></pre>
  
  <p>I'd essentially like to be able to test that</p>
  
  <ol>
  <li>It's actually making the request.</li>
  <li>It's using the GET method.</li>
  <li>It's using the right parameters.</li>
  <li>etc.</li>
  </ol>
  
  <p>The problem is that I'd like to be able to test this without actually making the request as it'll take too long and some operations are potentially destructive.</p>
  
  <p>How can I mock and test this quickly and easily?</p>