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

Side by Side Diff: appengine/findit/handlers/crash/test/crash_handler_test.py

Issue 2556463002: [Predator] Add https:// in front of feedback link. (Closed)
Patch Set: Fix tests. 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
« no previous file with comments | « appengine/findit/crash/findit_for_chromecrash.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 import base64 5 import base64
6 import copy 6 import copy
7 import json 7 import json
8 import logging 8 import logging
9 9
10 from google.appengine.api import app_identity 10 from google.appengine.api import app_identity
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 # and fragile mocking. 181 # and fragile mocking.
182 def _TestRunningAnalysisForResult(self, analysis_result, analysis_tags): 182 def _TestRunningAnalysisForResult(self, analysis_result, analysis_tags):
183 183
184 # Mock out the part of PublishResultPipeline that would go over the wire. 184 # Mock out the part of PublishResultPipeline that would go over the wire.
185 pubsub_publish_requests = [] 185 pubsub_publish_requests = []
186 def Mocked_PublishMessagesToTopic(messages_data, topic): 186 def Mocked_PublishMessagesToTopic(messages_data, topic):
187 pubsub_publish_requests.append((messages_data, topic)) 187 pubsub_publish_requests.append((messages_data, topic))
188 self.mock(crash_pipeline.pubsub_util, 'PublishMessagesToTopic', 188 self.mock(crash_pipeline.pubsub_util, 'PublishMessagesToTopic',
189 Mocked_PublishMessagesToTopic) 189 Mocked_PublishMessagesToTopic)
190 190
191 MOCK_HOST = 'https://host.com' 191 MOCK_HOST = 'host.com'
192 self.mock(app_identity, 'get_default_version_hostname', lambda: MOCK_HOST) 192 self.mock(app_identity, 'get_default_version_hostname', lambda: MOCK_HOST)
193 193
194 testcase = self 194 testcase = self
195 MOCK_KEY = 'MOCK_KEY' 195 MOCK_KEY = 'MOCK_KEY'
196 196
197 # Mock out the wrapper pipeline, so call the other pipelines directly 197 # Mock out the wrapper pipeline, so call the other pipelines directly
198 # instead of doing the yielding loop and spawning off processes. 198 # instead of doing the yielding loop and spawning off processes.
199 def mock_start_pipeline(self, **kwargs): 199 def mock_start_pipeline(self, **kwargs):
200 logging.info('Mock running on queue %s', kwargs['queue_name']) 200 logging.info('Mock running on queue %s', kwargs['queue_name'])
201 analysis_pipeline = crash_pipeline.CrashAnalysisPipeline( 201 analysis_pipeline = crash_pipeline.CrashAnalysisPipeline(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 # when things acciddentally go over the wire (and subsequently fail). 251 # when things acciddentally go over the wire (and subsequently fail).
252 try: 252 try:
253 self.execute_queued_tasks() 253 self.execute_queued_tasks()
254 except AppError, e: # pragma: no cover 254 except AppError, e: # pragma: no cover
255 raise e 255 raise e
256 256
257 self.assertEqual(1, len(pubsub_publish_requests)) 257 self.assertEqual(1, len(pubsub_publish_requests))
258 258
259 processed_analysis_result = copy.deepcopy(analysis_result) 259 processed_analysis_result = copy.deepcopy(analysis_result)
260 processed_analysis_result['feedback_url'] = ( 260 processed_analysis_result['feedback_url'] = (
261 '%s/crash/fracas-result-feedback?key=%s' % (MOCK_HOST, MOCK_KEY)) 261 'https://%s/crash/fracas-result-feedback?key=%s' % (MOCK_HOST,
262 MOCK_KEY))
262 263
263 for cl in processed_analysis_result.get('suspected_cls', []): 264 for cl in processed_analysis_result.get('suspected_cls', []):
264 cl['confidence'] = round(cl['confidence'], 2) 265 cl['confidence'] = round(cl['confidence'], 2)
265 cl.pop('reason', None) 266 cl.pop('reason', None)
266 267
267 expected_messages_data = [json.dumps({ 268 expected_messages_data = [json.dumps({
268 'crash_identifiers': crash_data['crash_identifiers'], 269 'crash_identifiers': crash_data['crash_identifiers'],
269 'client_id': CrashClient.FRACAS, 270 'client_id': CrashClient.FRACAS,
270 'result': processed_analysis_result, 271 'result': processed_analysis_result,
271 }, sort_keys=True)] 272 }, sort_keys=True)]
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 'has_regression_range': True, 335 'has_regression_range': True,
335 'solution': 'core', 336 'solution': 'core',
336 'unsupported_tag': '', 337 'unsupported_tag': '',
337 } 338 }
338 339
339 analysis = self._TestRunningAnalysisForResult( 340 analysis = self._TestRunningAnalysisForResult(
340 analysis_result, analysis_tags) 341 analysis_result, analysis_tags)
341 self.assertTrue(analysis.has_regression_range) 342 self.assertTrue(analysis.has_regression_range)
342 self.assertTrue(analysis.found_suspects) 343 self.assertTrue(analysis.found_suspects)
343 self.assertEqual('core', analysis.solution) 344 self.assertEqual('core', analysis.solution)
OLDNEW
« no previous file with comments | « appengine/findit/crash/findit_for_chromecrash.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698