| Index: appengine/findit/crash/test/findit_for_chromecrash_test.py
|
| diff --git a/appengine/findit/crash/test/findit_for_chromecrash_test.py b/appengine/findit/crash/test/findit_for_chromecrash_test.py
|
| index 8b33da2d236caaa1b9147c5c3dd24e2114b45bda..b0376bd4eb71904c4bf01790f041a44e6511693c 100644
|
| --- a/appengine/findit/crash/test/findit_for_chromecrash_test.py
|
| +++ b/appengine/findit/crash/test/findit_for_chromecrash_test.py
|
| @@ -30,13 +30,13 @@ from model import analysis_status
|
| from model.crash.crash_analysis import CrashAnalysis
|
| from model.crash.fracas_crash_analysis import FracasCrashAnalysis
|
|
|
| -MOCK_REPOSITORY = None
|
| +MOCK_GET_REPOSITORY = lambda _: None # pragma: no cover
|
|
|
| class _FinditForChromeCrash(FinditForChromeCrash): # pylint: disable = W
|
| - # We allow overriding the default MOCK_REPOSITORY because one unittest
|
| + # We allow overriding the default ``get_repository`` because one unittest
|
| # needs to.
|
| - def __init__(self, repository=MOCK_REPOSITORY):
|
| - super(_FinditForChromeCrash, self).__init__(repository)
|
| + def __init__(self, get_repository=MOCK_GET_REPOSITORY):
|
| + super(_FinditForChromeCrash, self).__init__(get_repository)
|
|
|
| @classmethod
|
| def _ClientID(cls): # pragma: no cover
|
| @@ -66,13 +66,15 @@ class _FinditForChromeCrash(FinditForChromeCrash): # pylint: disable = W
|
|
|
| def _FinditForFracas():
|
| """A helper to pass in the standard pipeline class."""
|
| - return FinditForFracas(MOCK_REPOSITORY)
|
| + return FinditForFracas(MOCK_GET_REPOSITORY)
|
|
|
|
|
| -class FinditForChromeCrashTest(PredatorTestCase):
|
| +def _GitilesRepositoryFactory(repo_url): # pragma: no cover
|
| + return gitiles_repository.GitilesRepository(
|
| + HttpClientAppengine(), repo_url)
|
| +
|
|
|
| - chrome_dep_fetcher = chrome_dependency_fetcher.ChromeDependencyFetcher(
|
| - gitiles_repository.GitilesRepository(HttpClientAppengine()))
|
| +class FinditForChromeCrashTest(PredatorTestCase):
|
|
|
| # TODO(wrengr): what was the purpose of this test? As written it's
|
| # just testing that mocking works. I'm guessing it was to check that
|
| @@ -91,8 +93,7 @@ class FinditForChromeCrashTest(PredatorTestCase):
|
| # the client_id?
|
| analysis.client_id = CrashClient.FRACAS
|
|
|
| - findit_client = _FinditForChromeCrash(
|
| - gitiles_repository.GitilesRepository(HttpClientAppengine()))
|
| + findit_client = _FinditForChromeCrash(_GitilesRepositoryFactory)
|
| self.assertIsNone(findit_client.FindCulprit(analysis))
|
|
|
|
|
| @@ -277,7 +278,7 @@ class FinditForFracasTest(PredatorTestCase):
|
| crash_identifiers = {'signature': 'sig'}
|
| analysis = FracasCrashAnalysis.Create(crash_identifiers)
|
| analysis.result = {'other': 'data'}
|
| - findit_object = FinditForFracas(None)
|
| + findit_object = FinditForFracas(MOCK_GET_REPOSITORY)
|
| expected_processed_suspect = {
|
| 'client_id': findit_object.client_id,
|
| 'crash_identifiers': {'signature': 'sig'},
|
|
|