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

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

Issue 2524633002: [Culprit-Finder] Refactor GitilesRepostory to make http_client required argument. (Closed)
Patch Set: Rebase Created 4 years 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 from common import chrome_dependency_fetcher 5 from common import chrome_dependency_fetcher
6 from common.dependency import DependencyRoll 6 from common.dependency import DependencyRoll
7 from common.http_client_appengine import HttpClientAppengine 7 from common.http_client_appengine import HttpClientAppengine
8 from crash import chromecrash_parser 8 from crash import chromecrash_parser
9 from crash import detect_regression_range 9 from crash import detect_regression_range
10 from crash import findit_for_chromecrash 10 from crash import findit_for_chromecrash
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return {} 62 return {}
63 63
64 def _FinditForFracas(): 64 def _FinditForFracas():
65 """A helper to pass in the standard pipeline class.""" 65 """A helper to pass in the standard pipeline class."""
66 return FinditForFracas(MOCK_REPOSITORY) 66 return FinditForFracas(MOCK_REPOSITORY)
67 67
68 68
69 class FinditForChromeCrashTest(CrashTestCase): 69 class FinditForChromeCrashTest(CrashTestCase):
70 70
71 chrome_dep_fetcher = chrome_dependency_fetcher.ChromeDependencyFetcher( 71 chrome_dep_fetcher = chrome_dependency_fetcher.ChromeDependencyFetcher(
72 gitiles_repository.GitilesRepository(http_client=HttpClientAppengine())) 72 gitiles_repository.GitilesRepository(HttpClientAppengine()))
73 73
74 # TODO(wrengr): what was the purpose of this test? As written it's 74 # TODO(wrengr): what was the purpose of this test? As written it's
75 # just testing that mocking works. I'm guessing it was to check that 75 # just testing that mocking works. I'm guessing it was to check that
76 # we fail when the analysis is for the wrong client_id; but if so, 76 # we fail when the analysis is for the wrong client_id; but if so,
77 # then we shouldn't need to mock FindCulprit... 77 # then we shouldn't need to mock FindCulprit...
78 def testFindCulprit(self): 78 def testFindCulprit(self):
79 self.mock(FinditForChromeCrash, 'FindCulprit', lambda self, *_: None) 79 self.mock(FinditForChromeCrash, 'FindCulprit', lambda self, *_: None)
80 80
81 # TODO(wrengr): would be less fragile to call 81 # TODO(wrengr): would be less fragile to call
82 # FinditForFracas.CreateAnalysis instead; though if I'm right about 82 # FinditForFracas.CreateAnalysis instead; though if I'm right about
83 # the original purpose of this test, then this is one of the few 83 # the original purpose of this test, then this is one of the few
84 # places where calling FracasCrashAnalysis directly would actually 84 # places where calling FracasCrashAnalysis directly would actually
85 # make sense. 85 # make sense.
86 analysis = FracasCrashAnalysis.Create({'signature': 'sig'}) 86 analysis = FracasCrashAnalysis.Create({'signature': 'sig'})
87 # TODO(wrengr): shouldn't FracasCrashAnalysis.Create already have set 87 # TODO(wrengr): shouldn't FracasCrashAnalysis.Create already have set
88 # the client_id? 88 # the client_id?
89 analysis.client_id = CrashClient.FRACAS 89 analysis.client_id = CrashClient.FRACAS
90 90
91 findit_client = _FinditForChromeCrash( 91 findit_client = _FinditForChromeCrash(
92 gitiles_repository.GitilesRepository(http_client=HttpClientAppengine())) 92 gitiles_repository.GitilesRepository(HttpClientAppengine()))
93 self.assertIsNone(findit_client.FindCulprit(analysis)) 93 self.assertIsNone(findit_client.FindCulprit(analysis))
94 94
95 95
96 class FinditForFracasTest(CrashTestCase): 96 class FinditForFracasTest(CrashTestCase):
97 97
98 def testPlatformRename(self): 98 def testPlatformRename(self):
99 self.assertEqual(_FinditForFracas().RenamePlatform('linux'), 'unix') 99 self.assertEqual(_FinditForFracas().RenamePlatform('linux'), 'unix')
100 100
101 def testCheckPolicyUnsupportedPlatform(self): 101 def testCheckPolicyUnsupportedPlatform(self):
102 self.assertIsNone(_FinditForFracas().CheckPolicy(DummyCrashData( 102 self.assertIsNone(_FinditForFracas().CheckPolicy(DummyCrashData(
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 expected_tag = { 252 expected_tag = {
253 'found_suspects': False, 253 'found_suspects': False,
254 'found_project': False, 254 'found_project': False,
255 'found_components': False, 255 'found_components': False,
256 'has_regression_range': False, 256 'has_regression_range': False,
257 'solution': 'core_algorithm', 257 'solution': 'core_algorithm',
258 } 258 }
259 259
260 self.assertDictEqual(expected_results, results) 260 self.assertDictEqual(expected_results, results)
261 self.assertDictEqual(expected_tag, tag) 261 self.assertDictEqual(expected_tag, tag)
OLDNEW
« no previous file with comments | « appengine/findit/crash/test/changelist_classifier_test.py ('k') | appengine/findit/handlers/crash/crash_handler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698