| Index: appengine/findit/crash/test/findit_test.py
|
| diff --git a/appengine/findit/crash/test/findit_test.py b/appengine/findit/crash/test/findit_test.py
|
| index 5d19d0aa3b054dd64242c9e20dc7144b34968535..7bce7a299bfb4dc7ad21484fbb1493c281e287a0 100644
|
| --- a/appengine/findit/crash/test/findit_test.py
|
| +++ b/appengine/findit/crash/test/findit_test.py
|
| @@ -11,13 +11,6 @@ from crash.test.crash_pipeline_test import DummyCrashData
|
| from crash.test.crash_testcase import CrashTestCase
|
| from model.crash.fracas_crash_analysis import FracasCrashAnalysis
|
|
|
| -# In production we'd use CrashWrapperPipeline. And that'd work fine here,
|
| -# since we never actually call the method that uses it. But just to be
|
| -# absolutely sure we don't go over the wire due to some mocking failure,
|
| -# we'll use this dummy class instead. (In fact, since it's never used,
|
| -# we don't even need to give a real class; ``None`` works just fine.)
|
| -MOCK_PIPELINE_CLS = None
|
| -
|
| MOCK_REPOSITORY = None
|
|
|
| class UnsupportedClient(Findit): # pylint: disable=W0223
|
| @@ -32,7 +25,7 @@ class UnsupportedClient(Findit): # pylint: disable=W0223
|
| return {}
|
|
|
| def __init__(self, client_id=None):
|
| - super(UnsupportedClient, self).__init__(MOCK_REPOSITORY, MOCK_PIPELINE_CLS)
|
| + super(UnsupportedClient, self).__init__(MOCK_REPOSITORY)
|
| if client_id is None:
|
| client_id = 'unsupported_client'
|
| self._client_id = client_id
|
| @@ -47,58 +40,9 @@ class FinditTest(CrashTestCase):
|
| return CrashClient.FRACAS
|
|
|
| self.assertEqual(
|
| - _MockFindit(MOCK_REPOSITORY, MOCK_PIPELINE_CLS).RenamePlatform('linux'),
|
| + _MockFindit(MOCK_REPOSITORY).RenamePlatform('linux'),
|
| 'unix')
|
|
|
| - def testScheduleNewAnalysisWithFailingPolicy(self):
|
| - class _MockFindit(Findit): # pylint: disable=W0223
|
| - def __init__(self):
|
| - super(_MockFindit, self).__init__(MOCK_REPOSITORY, MOCK_PIPELINE_CLS)
|
| -
|
| - def CheckPolicy(self, crash_data):
|
| - """This is the same as inherited, but just to be explicit."""
|
| - return None
|
| -
|
| - def _NeedsNewAnalysis(self, _crash_data):
|
| - raise AssertionError('testScheduleNewAnalysisWithFailingPolicy: '
|
| - "called _MockFindit._NeedsNewAnalysis, when it shouldn't.")
|
| -
|
| - self.assertFalse(_MockFindit().ScheduleNewAnalysis(DummyCrashData()))
|
| -
|
| - def testScheduleNewAnalysisWithPlatformRename(self):
|
| - original_crash_data = DummyCrashData(
|
| - version = None,
|
| - platform = 'unix',
|
| - crash_identifiers = {})
|
| - renamed_crash_data = copy.deepcopy(original_crash_data)
|
| - renamed_crash_data['platform'] = 'linux'
|
| -
|
| - testcase = self
|
| - class _MockFindit(Findit): # pylint: disable=W0223
|
| - def __init__(self):
|
| - super(_MockFindit, self).__init__(MOCK_REPOSITORY, MOCK_PIPELINE_CLS)
|
| -
|
| - @property
|
| - def config(self):
|
| - """Make PlatformRename work as expected."""
|
| - return {'platform_rename': {'unix': 'linux'}}
|
| -
|
| - def CheckPolicy(self, crash_data):
|
| - """Call PlatformRename, and return successfully.
|
| -
|
| - N.B., if we did not override this method, then our overridden
|
| - ``_NeedsNewAnalysis`` would never be called either."""
|
| - # TODO(wrengr): should we clone ``crash_data`` rather than mutating it?
|
| - crash_data['platform'] = self.RenamePlatform(crash_data['platform'])
|
| - return crash_data
|
| -
|
| - def _NeedsNewAnalysis(self, new_crash_data):
|
| - logging.debug('Called _MockFindit._NeedsNewAnalysis, as desired')
|
| - testcase.assertDictEqual(new_crash_data, renamed_crash_data)
|
| - return False
|
| -
|
| - self.assertFalse(_MockFindit().ScheduleNewAnalysis(original_crash_data))
|
| -
|
| def testCheckPolicyUnsupportedClient(self):
|
| self.assertIsNone(UnsupportedClient().CheckPolicy(DummyCrashData(
|
| platform = 'canary',
|
|
|