| 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 ab1c64121fbe43e7c279cd7cc8cbf59ab596109a..31ac5b5b05542ead9a65964051093be1ac39630b 100644
|
| --- a/appengine/findit/crash/test/findit_for_chromecrash_test.py
|
| +++ b/appengine/findit/crash/test/findit_for_chromecrash_test.py
|
| @@ -2,11 +2,14 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| +import mock
|
| +
|
| from common import chrome_dependency_fetcher
|
| from common.dependency import DependencyRoll
|
| from common.http_client_appengine import HttpClientAppengine
|
| from crash import chromecrash_parser
|
| from crash import detect_regression_range
|
| +from crash import findit
|
| from crash import findit_for_chromecrash
|
| from crash.changelist_classifier import ChangelistClassifier
|
| from crash.chromecrash_parser import ChromeCrashParser
|
| @@ -15,7 +18,6 @@ from crash.crash_report import CrashReport
|
| from crash.culprit import Culprit
|
| from crash.findit_for_chromecrash import FinditForChromeCrash
|
| from crash.findit_for_chromecrash import FinditForFracas
|
| -from crash.findit import Findit
|
| from crash.project_classifier import ProjectClassifier
|
| from crash.results import MatchResult
|
| from crash.stacktrace import CallStack
|
| @@ -30,7 +32,7 @@ from model.crash.fracas_crash_analysis import FracasCrashAnalysis
|
|
|
| MOCK_REPOSITORY = None
|
|
|
| -class _FinditForChromeCrash(FinditForChromeCrash):
|
| +class _FinditForChromeCrash(FinditForChromeCrash): # pylint: disable = W
|
| # We allow overriding the default MOCK_REPOSITORY because one unittest
|
| # needs to.
|
| def __init__(self, repository=MOCK_REPOSITORY):
|
| @@ -61,6 +63,7 @@ class _FinditForChromeCrash(FinditForChromeCrash):
|
| """
|
| return {}
|
|
|
| +
|
| def _FinditForFracas():
|
| """A helper to pass in the standard pipeline class."""
|
| return FinditForFracas(MOCK_REPOSITORY)
|
| @@ -259,3 +262,31 @@ class FinditForFracasTest(CrashTestCase):
|
|
|
| self.assertDictEqual(expected_results, results)
|
| self.assertDictEqual(expected_tag, tag)
|
| +
|
| + @mock.patch('google.appengine.ext.ndb.Key.urlsafe')
|
| + @mock.patch('common.appengine_util.GetDefaultVersionHostname')
|
| + def testProcessResultForPublishing(self, mocked_get_default_host,
|
| + mocked_urlsafe):
|
| + mocked_host = 'http://host'
|
| + mocked_get_default_host.return_value = mocked_host
|
| + urlsafe_key = 'abcde'
|
| + mocked_urlsafe.return_value = urlsafe_key
|
| +
|
| + crash_identifiers = {'signature': 'sig'}
|
| + analysis = FracasCrashAnalysis.Create(crash_identifiers)
|
| + analysis.result = {'other': 'data'}
|
| + findit_object = FinditForFracas(None)
|
| + expected_processed_result = {
|
| + 'client_id': findit_object.client_id,
|
| + 'crash_identifiers': {'signature': 'sig'},
|
| + 'result': {
|
| + 'feedback_url': (
|
| + findit_for_chromecrash._FRACAS_FEEDBACK_URL_TEMPLATE % (
|
| + mocked_host, urlsafe_key)),
|
| + 'other': 'data'
|
| + }
|
| + }
|
| +
|
| + self.assertDictEqual(findit_object.GetPublishableResult(crash_identifiers,
|
| + analysis),
|
| + expected_processed_result)
|
|
|