Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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