Index: dashboard/dashboard/bisect_fyi_test.py |
diff --git a/dashboard/dashboard/bisect_fyi_test.py b/dashboard/dashboard/bisect_fyi_test.py |
index 5fe244b6666bdd9065c80766600098a30e130ae4..5019087302c32b5f4506866fe827a681391469c5 100644 |
--- a/dashboard/dashboard/bisect_fyi_test.py |
+++ b/dashboard/dashboard/bisect_fyi_test.py |
@@ -9,10 +9,12 @@ import webapp2 |
import webtest |
from dashboard import bisect_fyi |
+from dashboard import issue_tracker_service |
from dashboard import namespaced_stored_object |
from dashboard import start_try_job |
from dashboard import stored_object |
from dashboard import testing_common |
+from dashboard import utils |
TEST_FYI_CONFIGS = { |
'positive_culprit': { |
@@ -59,6 +61,8 @@ TEST_FYI_CONFIGS = { |
} |
+@mock.patch('apiclient.discovery.build', mock.MagicMock()) |
+@mock.patch.object(utils, 'ServiceAccountCredentials', mock.MagicMock()) |
class BisectFYITest(testing_common.TestCase): |
def setUp(self): |
@@ -79,19 +83,24 @@ class BisectFYITest(testing_common.TestCase): |
} |
}) |
+ @mock.patch.object( |
+ issue_tracker_service.IssueTrackerService, 'AddBugComment') |
@mock.patch.object(bisect_fyi.start_try_job, '_PerformBuildbucketBisect') |
- def testPost_FailedJobs_BisectFYI(self, mock_perform_bisect): |
+ def testPost_FailedJobs_BisectFYI(self, mock_perform_bisect, _): |
mock_perform_bisect.return_value = {'error': 'PerformBisect Failed'} |
self.testapp.post('/bisect_fyi') |
messages = self.mail_stub.get_sent_messages() |
self.assertEqual(1, len(messages)) |
+ @mock.patch.object( |
+ issue_tracker_service.IssueTrackerService, 'AddBugComment') |
@mock.patch.object(bisect_fyi.start_try_job, '_PerformBuildbucketBisect') |
- def testPost_SuccessJobs_BisectFYI(self, mock_perform_bisect): |
+ def testPost_SuccessJobs_BisectFYI(self, mock_perform_bisect, mock_comment): |
mock_perform_bisect.return_value = {'issue_id': 'http://fake'} |
self.testapp.post('/bisect_fyi') |
messages = self.mail_stub.get_sent_messages() |
self.assertEqual(0, len(messages)) |
+ mock_comment.assert_called_with(222, mock.ANY, send_email=False) |
if __name__ == '__main__': |