import responses
@responses.activate
def test_my_api():
responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
body='{"error": "not found"}', status=404,
content_type='application/json')
resp = requests.get('http://twitter.com/api/1/foobar')
assert resp.json() == {"error": "not found"}
Last active
December 28, 2015 11:19
-
-
Save dcramer/7492965 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment