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

Unified Diff: appengine/findit/model/crash/test/crash_analysis_test.py

Issue 2523343002: [Predator] Refactor ToPublishResult and fix keyerror 'found' (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/findit/model/crash/crash_analysis.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/model/crash/test/crash_analysis_test.py
diff --git a/appengine/findit/model/crash/test/crash_analysis_test.py b/appengine/findit/model/crash/test/crash_analysis_test.py
index b0c6942120c8c4e3b838d19d545fb096362daacc..63c87b2a7335c990424cf6d65cbb3c62b0648ef2 100644
--- a/appengine/findit/model/crash/test/crash_analysis_test.py
+++ b/appengine/findit/model/crash/test/crash_analysis_test.py
@@ -5,8 +5,6 @@
import copy
from datetime import datetime
-from google.appengine.api import app_identity
-
from crash.type_enums import CrashClient
from crash.test.crash_testcase import CrashTestCase
from model import analysis_status
@@ -106,69 +104,3 @@ class CrashAnalysisTest(CrashTestCase):
analysis.put()
self.assertIsNotNone(analysis)
self.assertEqual(CrashAnalysis.Get(crash_identifiers), analysis)
-
- def testGetPublishableResulFoundTrue(self):
- mock_host = 'https://host.com'
- self.mock(app_identity, 'get_default_version_hostname', lambda: mock_host)
-
- analysis_result = {
- 'found': True,
- 'suspected_cls': [
- {'confidence': 0.21434,
- 'reason': ['reason1', 'reason2'],
- 'other': 'data'}
- ],
- 'other_data': 'data',
- }
-
- processed_analysis_result = copy.deepcopy(analysis_result)
- processed_analysis_result['feedback_url'] = (
- mock_host + '/crash/fracas-result-feedback?'
- 'key=agx0ZXN0YmVkLXRlc3RyQQsSE0ZyYWNhc0NyYXNoQW5hbHlzaXMiKDMzNTY5MDU3'
- 'M2ZlYTFlZGZhMjViOTVjZmI4OGZhODFlNDk0YTEyODkM')
-
- for cl in processed_analysis_result['suspected_cls']:
- cl['confidence'] = round(cl['confidence'], 2)
- cl.pop('reason', None)
-
- crash_identifiers = {'signature': 'sig'}
- expected_messages_data = {
- 'crash_identifiers': crash_identifiers,
- 'client_id': CrashClient.FRACAS,
- 'result': processed_analysis_result,
- }
-
- analysis = FracasCrashAnalysis.Create(crash_identifiers)
- analysis.client_id = CrashClient.FRACAS
- analysis.result = analysis_result
-
- self.assertDictEqual(analysis.ToPublishableResult(crash_identifiers),
- expected_messages_data)
-
- def testToPublishableResultFoundFalse(self):
- mock_host = 'https://host.com'
- self.mock(app_identity, 'get_default_version_hostname', lambda: mock_host)
-
- analysis_result = {
- 'found': False,
- }
-
- processed_analysis_result = copy.deepcopy(analysis_result)
- processed_analysis_result['feedback_url'] = (
- mock_host + '/crash/fracas-result-feedback?'
- 'key=agx0ZXN0YmVkLXRlc3RyQQsSE0ZyYWNhc0NyYXNoQW5hbHlzaXMiKDMzNTY5MDU3'
- 'M2ZlYTFlZGZhMjViOTVjZmI4OGZhODFlNDk0YTEyODkM')
-
- crash_identifiers = {'signature': 'sig'}
- expected_messages_data = {
- 'crash_identifiers': crash_identifiers,
- 'client_id': CrashClient.FRACAS,
- 'result': processed_analysis_result,
- }
-
- analysis = FracasCrashAnalysis.Create(crash_identifiers)
- analysis.client_id = CrashClient.FRACAS
- analysis.result = analysis_result
-
- self.assertDictEqual(analysis.ToPublishableResult(crash_identifiers),
- expected_messages_data)
« no previous file with comments | « appengine/findit/model/crash/crash_analysis.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698