| OLD | NEW |
| 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 json | 5 import json |
| 6 import os | 6 import os |
| 7 import webapp2 | 7 import webapp2 |
| 8 | 8 |
| 9 from testing_utils import testing | 9 from testing_utils import testing |
| 10 | 10 |
| 11 from common.git_repository import GitRepository | |
| 12 from handlers import help_triage | 11 from handlers import help_triage |
| 12 from lib.gitiles.gitiles_repository import GitilesRepository |
| 13 from model.wf_analysis import WfAnalysis | 13 from model.wf_analysis import WfAnalysis |
| 14 from model.wf_build import WfBuild | 14 from model.wf_build import WfBuild |
| 15 from waterfall import buildbot | 15 from waterfall import buildbot |
| 16 from waterfall import build_util |
| 16 from waterfall.build_info import BuildInfo | 17 from waterfall.build_info import BuildInfo |
| 17 from waterfall import build_util | |
| 18 | 18 |
| 19 | 19 |
| 20 EXPECTED_RESULTS_120 = { | 20 EXPECTED_RESULTS_120 = { |
| 21 '598ed4fa15e6a1d0d92b2b7df04fc31ab5d6e829': { | 21 '598ed4fa15e6a1d0d92b2b7df04fc31ab5d6e829': { |
| 22 'fixed_cl_review_url': 'https://codereview.chromium.org/12578123', | 22 'fixed_cl_review_url': 'https://codereview.chromium.org/12578123', |
| 23 'fixing_build_url': ( | 23 'fixing_build_url': ( |
| 24 'https://build.chromium.org/p/m/builders/b/builds/121'), | 24 'https://build.chromium.org/p/m/builders/b/builds/121'), |
| 25 'fixed_build_url': ( | 25 'fixed_build_url': ( |
| 26 'https://build.chromium.org/p/m/builders/b/builds/120'), | 26 'https://build.chromium.org/p/m/builders/b/builds/120'), |
| 27 'fixed_build_number': 120, | 27 'fixed_build_number': 120, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 commit_log = f.read() | 162 commit_log = f.read() |
| 163 return revision, json.loads(commit_log[len(')]}\'\n'):]) | 163 return revision, json.loads(commit_log[len(')]}\'\n'):]) |
| 164 | 164 |
| 165 def setUp(self): | 165 def setUp(self): |
| 166 super(HelpTriageTest, self).setUp() | 166 super(HelpTriageTest, self).setUp() |
| 167 self.master_name = 'm' | 167 self.master_name = 'm' |
| 168 self.builder_name = 'b' | 168 self.builder_name = 'b' |
| 169 self.mock_current_user(user_email='test@chromium.org', is_admin=True) | 169 self.mock_current_user(user_email='test@chromium.org', is_admin=True) |
| 170 self.mock(build_util, 'DownloadBuildData', | 170 self.mock(build_util, 'DownloadBuildData', |
| 171 self._MockDownloadBuildData) | 171 self._MockDownloadBuildData) |
| 172 self.mock(GitRepository, '_DownloadChangeLogData', | 172 self.mock(GitilesRepository, '_DownloadChangeLogData', |
| 173 self._MockDownloadChangeLogData) | 173 self._MockDownloadChangeLogData) |
| 174 | 174 |
| 175 def _CreateAnalysis(self, build_number, first_failure, last_pass=None): | 175 def _CreateAnalysis(self, build_number, first_failure, last_pass=None): |
| 176 analysis = WfAnalysis.Create( | 176 analysis = WfAnalysis.Create( |
| 177 self.master_name, self.builder_name, build_number) | 177 self.master_name, self.builder_name, build_number) |
| 178 analysis.result = { | 178 analysis.result = { |
| 179 'failures': [ | 179 'failures': [ |
| 180 { | 180 { |
| 181 'last_pass': last_pass, | 181 'last_pass': last_pass, |
| 182 'first_failure': first_failure, | 182 'first_failure': first_failure, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 self.master_name, self.builder_name, 123) | 257 self.master_name, self.builder_name, 123) |
| 258 build = WfBuild.Create(self.master_name, self.builder_name, 123) | 258 build = WfBuild.Create(self.master_name, self.builder_name, 123) |
| 259 build.data = self._GetBuildInfo(self.master_name, self.builder_name, 123) | 259 build.data = self._GetBuildInfo(self.master_name, self.builder_name, 123) |
| 260 build.put() | 260 build.put() |
| 261 | 261 |
| 262 response = self.test_app.get('/help-triage', params={'url': build_url}) | 262 response = self.test_app.get('/help-triage', params={'url': build_url}) |
| 263 expected_results = {} | 263 expected_results = {} |
| 264 | 264 |
| 265 self.assertEqual(200, response.status_int) | 265 self.assertEqual(200, response.status_int) |
| 266 self.assertEqual(expected_results, response.json_body) | 266 self.assertEqual(expected_results, response.json_body) |
| OLD | NEW |