Skip to content

Instantly share code, notes, and snippets.

@GabiThume
Last active December 19, 2015 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GabiThume/5902363 to your computer and use it in GitHub Desktop.
Save GabiThume/5902363 to your computer and use it in GitHub Desktop.
@mock.patch('requests.get')
def test_exploitable_crashes(self, rget):
url = reverse('crashstats.exploitable_crashes')
def mocked_get(url, **options):
assert 'crashes/exploitability' in url
return Response("""
{
"hits": [
{
"signature": "FakeSignature",
"report_date": "2013-06-06",
"high_count": 4,
"medium_count": 3,
"low_count": 2,
"none_count": 1
}
]
}
""")
rget.side_effect = mocked_get
response = self.client.get(url)
ok_(settings.LOGIN_URL in response['Location'] + '?next=%s' % url)
ok_(response.status_code, 302)
User.objects.create_user('test', 'test@mozilla.com', 'secret')
assert self.client.login(username='test', password='secret')
response = self.client.get(url)
ok_(response.status_code, 200)
@GabiThume
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment