Skip to content

Instantly share code, notes, and snippets.

@GabiThume
Last active Dec 19, 2015
Embed
What would you like to do?
@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

GabiThume commented Jul 1, 2013

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