Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(682)

Side by Side Diff: appengine/findit/crash/test/findit_test.py

Issue 2673733002: [Predator] Add CrashData class to process raw json crash data. (Closed)
Patch Set: Rebase and fix nits. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import copy 5 import copy
6 import logging 6 import logging
7 7
8 from google.appengine.api import app_identity 8 from google.appengine.api import app_identity
9 9
10 from crash.findit import Findit 10 from crash.findit import Findit
11 from crash.type_enums import CrashClient 11 from crash.type_enums import CrashClient
12 from crash.test.crash_pipeline_test import DummyCrashData
13 from crash.test.predator_testcase import PredatorTestCase 12 from crash.test.predator_testcase import PredatorTestCase
14 from model.crash.fracas_crash_analysis import FracasCrashAnalysis 13 from model.crash.fracas_crash_analysis import FracasCrashAnalysis
15 14
16 15
17 MOCK_GET_REPOSITORY = lambda _: None # pragma: no cover 16 MOCK_GET_REPOSITORY = lambda _: None # pragma: no cover
18 17
19 18
20 class UnsupportedClient(Findit): # pylint: disable=W0223 19 class UnsupportedClient(Findit): # pylint: disable=W0223
21 # TODO(http://crbug.com/659346): this isn't being called for some reason. 20 # TODO(http://crbug.com/659346): this isn't being called for some reason.
22 @property 21 @property
(...skipping 30 matching lines...) Expand all
53 52
54 def setUp(self): 53 def setUp(self):
55 super(FinditTest, self).setUp() 54 super(FinditTest, self).setUp()
56 self.findit = MockFindit() 55 self.findit = MockFindit()
57 56
58 def testPlatformRename(self): 57 def testPlatformRename(self):
59 self.assertEqual( 58 self.assertEqual(
60 self.findit.RenamePlatform('linux'), 'unix') 59 self.findit.RenamePlatform('linux'), 'unix')
61 60
62 def testCheckPolicyUnsupportedClient(self): 61 def testCheckPolicyUnsupportedClient(self):
63 self.assertIsNone(UnsupportedClient().CheckPolicy(DummyCrashData( 62 self.assertIsNone(UnsupportedClient().CheckPolicy(self.GetDummyCrashData(
64 platform = 'canary', 63 platform = 'canary',
65 signature = 'sig', 64 signature = 'sig',
66 ))) 65 )))
67 66
68 def testCreateAnalysisForUnsupportedClientId(self): 67 def testCreateAnalysisForUnsupportedClientId(self):
69 self.assertIsNone(UnsupportedClient('unsupported_id').CreateAnalysis( 68 self.assertIsNone(UnsupportedClient('unsupported_id').CreateAnalysis(
70 {'signature': 'sig'})) 69 {'signature': 'sig'}))
71 70
72 def testGetAnalysisForUnsuportedClient(self): 71 def testGetAnalysisForUnsuportedClient(self):
73 crash_identifiers = {'signature': 'sig'} 72 crash_identifiers = {'signature': 'sig'}
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 'client_id': self.findit.client_id, 121 'client_id': self.findit.client_id,
123 'result': copy.deepcopy(analysis_result), 122 'result': copy.deepcopy(analysis_result),
124 } 123 }
125 124
126 analysis = FracasCrashAnalysis.Create(crash_identifiers) 125 analysis = FracasCrashAnalysis.Create(crash_identifiers)
127 analysis.result = analysis_result 126 analysis.result = analysis_result
128 127
129 self.assertDictEqual(self.findit.GetPublishableResult(crash_identifiers, 128 self.assertDictEqual(self.findit.GetPublishableResult(crash_identifiers,
130 analysis), 129 analysis),
131 expected_processed_result) 130 expected_processed_result)
OLDNEW
« no previous file with comments | « appengine/findit/crash/test/findit_for_chromecrash_test.py ('k') | appengine/findit/crash/test/predator_testcase.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698