Browse files

fixes bug 865481 - CrashPairsByCrashId and report/index with HangID

  • Loading branch information...
1 parent e176ec6 commit 1afa115ec419c7fb5418ef64f9b15655ca67aa2b @peterbe peterbe committed Apr 24, 2013
Showing with 102 additions and 3 deletions.
  1. +100 −0 crashstats/crashstats/tests/test_views.py
  2. +2 −3 crashstats/crashstats/views.py
View
100 crashstats/crashstats/tests/test_views.py
@@ -1892,6 +1892,106 @@ def mocked_post(url, **options):
ok_(url0 in response.content)
eq_(response.status_code, 200)
+ @mock.patch('requests.post')
+ @mock.patch('requests.get')
+ def test_report_index_with_hangid_in_raw_data(self, rget, rpost):
+ dump = "OS|Mac OS X|10.6.8 10K549\\nCPU|amd64|family 6 mod"
+ comment0 = "This is a comment"
+ email0 = "some@emailaddress.com"
+ url0 = "someaddress.com"
+ email1 = "some@otheremailaddress.com"
+
+ def mocked_get(url, **options):
+ if '/crash_data/' in url and '/datatype/meta/' in url:
+ return Response("""
+ {
+ "InstallTime": "1339289895",
+ "FramePoisonSize": "4096",
+ "Theme": "classic/1.0",
+ "Version": "5.0a1",
+ "Email": "%s",
+ "Vendor": "Mozilla",
+ "URL": "%s",
+ "HangID": "123456789"
+ }
+ """ % (email0, url0))
+ if '/crashes/paireduuid/' in url:
+ return Response("""
+ {
+ "hits": [{
+ "uuid": "e8820616-1462-49b6-9784-e99a32120201"
+ }],
+ "total": 1
+ }
+ """)
+ if 'crashes/comments' in url:
+ return Response("""
+ {
+ "hits": [
+ {
+ "user_comments": "%s",
+ "date_processed": "2012-08-21T11:17:28-07:00",
+ "email": "%s",
+ "uuid": "469bde48-0e8f-3586-d486-b98810120830"
+ }
+ ],
+ "total": 1
+ }
+ """ % (comment0, email1))
+
+ if '/crash_data/' in url and '/datatype/processed' in url:
+ return Response("""
+ {
+ "client_crash_date": "2012-06-11T06:08:45",
+ "dump": "%s",
+ "signature": "FakeSignature1",
+ "user_comments": null,
+ "uptime": 14693,
+ "release_channel": "nightly",
+ "uuid": "11cb72f5-eb28-41e1-a8e4-849982120611",
+ "flash_version": "[blank]",
+ "hangid": null,
+ "distributor_version": null,
+ "truncated": true,
+ "process_type": null,
+ "id": 383569625,
+ "os_version": "10.6.8 10K549",
+ "version": "5.0a1",
+ "build": "20120609030536",
+ "ReleaseChannel": "nightly",
+ "addons_checked": null,
+ "product": "WaterWolf",
+ "os_name": "Mac OS X",
+ "last_crash": 371342,
+ "date_processed": "2012-06-11T06:08:44",
+ "cpu_name": "amd64",
+ "reason": "EXC_BAD_ACCESS / KERN_INVALID_ADDRESS",
+ "address": "0x8",
+ "completeddatetime": "2012-06-11T06:08:57",
+ "success": true
+ }
+ """ % dump)
+
+ raise NotImplementedError(url)
+ rget.side_effect = mocked_get
+
+ def mocked_post(url, **options):
+ if '/bugs/' in url:
+ return Response("""
+ {"hits": [{"id": "123456789",
+ "signature": "Something"}]}
+ """)
+ raise NotImplementedError(url)
+
+ rpost.side_effect = mocked_post
+
+ url = reverse('crashstats.report_index',
+ args=['11cb72f5-eb28-41e1-a8e4-849982120611'])
+ response = self.client.get(url)
+ ok_('Hang Minidump' in response.content)
+ # the HangID in the fixture above
+ ok_('123456789' in response.content)
+
@mock.patch('requests.get')
def test_report_index_not_found(self, rget):
crash_id = '11cb72f5-eb28-41e1-a8e4-849982120611'
View
5 crashstats/crashstats/views.py
@@ -835,11 +835,10 @@ def report_index(request, crash_id):
if 'HangID' in data['raw']:
data['hang_id'] = data['raw']['HangID']
-
crash_pair_api = models.CrashPairsByCrashId()
data['crash_pairs'] = crash_pair_api.get(
- data['report']['uuid'],
- data['hang_id']
+ crash_id=data['report']['uuid'],
+ hang_id=data['hang_id']
)
data['raw_dump_urls'] = [

0 comments on commit 1afa115

Please sign in to comment.