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

Unified Diff: dashboard/dashboard/start_try_job_test.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dashboard/dashboard/start_try_job.py ('k') | dashboard/dashboard/templates/bad_bisect.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/start_try_job_test.py
diff --git a/dashboard/dashboard/start_try_job_test.py b/dashboard/dashboard/start_try_job_test.py
index a4d9ff3e80e16dcf2e6ff3d31ab820c82a9665e1..2af159ec04fb8c4e6ecbdf36e26f9490a1bd9288 100644
--- a/dashboard/dashboard/start_try_job_test.py
+++ b/dashboard/dashboard/start_try_job_test.py
@@ -13,10 +13,12 @@ import webtest
from google.appengine.ext import ndb
from dashboard import can_bisect
+from dashboard import issue_tracker_service
from dashboard import namespaced_stored_object
from dashboard import rietveld_service
from dashboard import start_try_job
from dashboard import testing_common
+from dashboard import utils
from dashboard.models import bug_data
from dashboard.models import graph_data
from dashboard.models import try_job
@@ -309,6 +311,8 @@ def _MockMakeRequest(path, *args, **kwargs): # pylint: disable=unused-argument
assert False, 'Invalid url %s requested!' % path
+@mock.patch('apiclient.discovery.build', mock.MagicMock())
+@mock.patch.object(utils, 'ServiceAccountCredentials', mock.MagicMock())
class StartBisectTest(testing_common.TestCase):
def setUp(self):
@@ -732,7 +736,9 @@ class StartBisectTest(testing_common.TestCase):
@mock.patch.object(start_try_job.buildbucket_service, 'PutJob',
mock.MagicMock(return_value='1234567'))
- def testPerformBuildbucketBisect(self):
+ @mock.patch.object(
+ issue_tracker_service.IssueTrackerService, 'AddBugComment')
+ def testPerformBuildbucketBisect(self, add_bug_comment_mock):
self.SetCurrentUser('foo@chromium.org')
bug_data.Bug(id=12345).put()
@@ -757,6 +763,9 @@ class StartBisectTest(testing_common.TestCase):
try_job.TryJob.buildbucket_job_id == '1234567').fetch()
self.assertEqual(1, len(job_entities))
self.assertTrue(job_entities[0].use_buildbucket)
+ add_bug_comment_mock.assert_called_once_with(
+ 12345, 'Started bisect job https://None/buildbucket_job_status/1234567',
+ send_email=False)
def testPerformBisect_InvalidConfig_ReturnsError(self):
bisect_job = try_job.TryJob(
@@ -770,13 +779,14 @@ class StartBisectTest(testing_common.TestCase):
{'error': 'No "recipe_tester_name" given.'},
start_try_job.PerformBisect(bisect_job))
+ @mock.patch.object(issue_tracker_service.IssueTrackerService, 'AddBugComment')
@mock.patch(
'google.appengine.api.urlfetch.fetch',
mock.MagicMock(side_effect=_MockFetch))
@mock.patch.object(
start_try_job.rietveld_service.RietveldService, 'MakeRequest',
mock.MagicMock(side_effect=_MockMakeRequest))
- def testPerformBisect(self):
+ def testPerformBisect(self, _):
self.SetCurrentUser('foo@chromium.org')
# Create bug.
@@ -832,13 +842,14 @@ class StartBisectTest(testing_common.TestCase):
response = self.testapp.post('/start_try_job', query_parameters)
self.assertEqual(json.dumps({'issue_id': '33001'}), response.body)
+ @mock.patch.object(issue_tracker_service.IssueTrackerService, 'AddBugComment')
@mock.patch(
'google.appengine.api.urlfetch.fetch',
mock.MagicMock(side_effect=_MockFailedFetch))
@mock.patch.object(
start_try_job.rietveld_service.RietveldService, 'MakeRequest',
mock.MagicMock(side_effect=_MockMakeRequest))
- def testPerformBisectStep_DeleteJobOnFailedBisect(self):
+ def testPerformBisectStep_DeleteJobOnFailedBisect(self, _):
self.SetCurrentUser('foo@chromium.org')
query_parameters = {
'bisect_bot': 'linux_perf_bisect',
@@ -894,7 +905,9 @@ class StartBisectTest(testing_common.TestCase):
mock.MagicMock(return_value='my-dashboard.appspot.com'))
@mock.patch.object(start_try_job.buildbucket_service, 'PutJob',
mock.MagicMock(return_value='1234567'))
- def testPerformBisectWithArchive(self):
+ @mock.patch.object(
+ issue_tracker_service.IssueTrackerService, 'AddBugComment')
+ def testPerformBisectWithArchive(self, _):
self.SetCurrentUser('foo@chromium.org')
# Create bug.
« no previous file with comments | « dashboard/dashboard/start_try_job.py ('k') | dashboard/dashboard/templates/bad_bisect.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698