Created
September 18, 2013 23:55
-
-
Save GabiThume/6617400 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = models.TCBS | |
api = model() | |
def mocked_get(**options): | |
assert 'crashes/signatures' in options['url'] | |
# expect no os_name parameter encoded in the URL | |
assert '/os/' not in options['url'] | |
return Response(""" | |
{"crashes": [], | |
"totalPercentage": 0, | |
"start_date": "2013-05-10", | |
"end_date": "2013-05-24", | |
"totalNumberOfCrashes": 0} | |
""") | |
rget.side_effect = mocked_get | |
today = datetime.datetime.utcnow() | |
api.get( | |
product='Firefox', | |
version='23.0.1', | |
crash_type='browser', | |
end_date=today, | |
date_range_type='report', | |
duration=168, | |
limit=300 | |
) | |
assert incr.called | |
# test for https://crash-stats.mozilla.com/bpapi/crashes/signatures/product/Firefox/version/23.0.1/crash_type/browser/end_date/2013-09-18T17%3A29%3A40/date_range_type/report/duration/168/limit/300/ | |
metric = "middleware.GET.crashes/signatures/product/Firefox/version/23-0-1/crash_type/browser/end_date/XXXX-XX-XX/date_range_type/report/duration/168/limit/300/.200" | |
incr.assert_called_with(metric) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment