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

Side by Side Diff: appengine/findit/handlers/test/monitor_alerts_test.py

Issue 1866883002: [Findit] A huge refactoring and some bug fixing. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nit. Created 4 years, 8 months 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
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 textwrap 5 import textwrap
6 6
7 import webapp2 7 import webapp2
8 8
9 from common import constants
9 from common.http_client_appengine import RetryHttpClient 10 from common.http_client_appengine import RetryHttpClient
10 from handlers import monitor_alerts 11 from handlers import monitor_alerts
11 from waterfall import build_failure_analysis_pipelines 12 from waterfall import build_failure_analysis_pipelines
12 from waterfall.test import wf_testcase 13 from waterfall.test import wf_testcase
13 14
14 15
15 class _MockedHttpClient(RetryHttpClient): 16 class _MockedHttpClient(RetryHttpClient):
16 17
17 def __init__(self, status_code, content): 18 def __init__(self, status_code, content):
18 self.status_code = status_code 19 self.status_code = status_code
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 }, 155 },
155 ] 156 ]
156 157
157 def MockGetLatestBuildFailures(*_): 158 def MockGetLatestBuildFailures(*_):
158 return build_failures 159 return build_failures
159 self.mock( 160 self.mock(
160 monitor_alerts, '_GetLatestBuildFailures', MockGetLatestBuildFailures) 161 monitor_alerts, '_GetLatestBuildFailures', MockGetLatestBuildFailures)
161 162
162 expected_scheduled_analyses = [ 163 expected_scheduled_analyses = [
163 ('m3', 'b3', 3, ['s3'], False, 164 ('m3', 'b3', 3, ['s3'], False,
164 monitor_alerts._BUILD_FAILURE_ANALYSIS_TASKQUEUE), 165 constants.WATERFALL_ANALYSIS_QUEUE),
165 ] 166 ]
166 167
167 scheduled_analyses = [] 168 scheduled_analyses = []
168 def MockScheduleAnalysisIfNeeded(master_name, builder_name, build_number, 169 def MockScheduleAnalysisIfNeeded(master_name, builder_name, build_number,
169 failed_steps, force, queue_name): 170 failed_steps, force, queue_name):
170 scheduled_analyses.append( 171 scheduled_analyses.append(
171 (master_name, builder_name, build_number, 172 (master_name, builder_name, build_number,
172 failed_steps, force, queue_name)) 173 failed_steps, force, queue_name))
173 174
174 self.mock(build_failure_analysis_pipelines, 'ScheduleAnalysisIfNeeded', 175 self.mock(build_failure_analysis_pipelines, 'ScheduleAnalysisIfNeeded',
175 MockScheduleAnalysisIfNeeded) 176 MockScheduleAnalysisIfNeeded)
176 177
177 self.mock_current_user(user_email='test@chromium.org', is_admin=True) 178 self.mock_current_user(user_email='test@chromium.org', is_admin=True)
178 response = self.test_app.get('/monitor-alerts') 179 response = self.test_app.get('/monitor-alerts')
179 self.assertEqual(200, response.status_int) 180 self.assertEqual(200, response.status_int)
180 181
181 self.assertEqual(expected_scheduled_analyses, scheduled_analyses) 182 self.assertEqual(expected_scheduled_analyses, scheduled_analyses)
OLDNEW
« no previous file with comments | « appengine/findit/handlers/test/list_analyses_test.py ('k') | appengine/findit/handlers/test/triage_analysis_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698