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

Side by Side Diff: dashboard/dashboard/email_sheriff_test.py

Issue 2138843003: Add support for setting sheriff-specific bug labels. (Closed) Base URL: https://github.com/catapult-project/catapult@master
Patch Set: Fix unit tests 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 unified diff | Download patch
« no previous file with comments | « dashboard/dashboard/edit_sheriffs_test.py ('k') | dashboard/dashboard/email_summary_test.py » ('j') | 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 sys 5 import sys
6 import unittest 6 import unittest
7 import urllib 7 import urllib
8 8
9 import mock 9 import mock
10 10
(...skipping 15 matching lines...) Expand all
26 def _AddTestToStubDataStore(self): 26 def _AddTestToStubDataStore(self):
27 """Adds a test which will be used in the methods below.""" 27 """Adds a test which will be used in the methods below."""
28 bug_label_patterns.AddBugLabelPattern('label1', '*/*/dromaeo/dom') 28 bug_label_patterns.AddBugLabelPattern('label1', '*/*/dromaeo/dom')
29 bug_label_patterns.AddBugLabelPattern('label2', '*/*/other/test') 29 bug_label_patterns.AddBugLabelPattern('label2', '*/*/other/test')
30 testing_common.AddTests( 30 testing_common.AddTests(
31 ['ChromiumPerf'], ['Win7'], {'dromaeo': {'dom': {}}}) 31 ['ChromiumPerf'], ['Win7'], {'dromaeo': {'dom': {}}})
32 test = utils.TestKey('ChromiumPerf/Win7/dromaeo/dom').get() 32 test = utils.TestKey('ChromiumPerf/Win7/dromaeo/dom').get()
33 test.improvement_direction = anomaly.DOWN 33 test.improvement_direction = anomaly.DOWN
34 sheriff.Sheriff( 34 sheriff.Sheriff(
35 id='Chromium Perf Sheriff', 35 id='Chromium Perf Sheriff',
36 url=_SHERIFF_URL, email=_SHERIFF_EMAIL).put() 36 url=_SHERIFF_URL,
37 email=_SHERIFF_EMAIL,
38 labels=['Performance-Sheriff']).put()
37 return test 39 return test
38 40
39 def _GetDefaultMailArgs(self): 41 def _GetDefaultMailArgs(self):
40 """Adds an Anomaly and returns arguments for email_sheriff.EmailSheriff.""" 42 """Adds an Anomaly and returns arguments for email_sheriff.EmailSheriff."""
41 test_entity = self._AddTestToStubDataStore() 43 test_entity = self._AddTestToStubDataStore()
42 sheriff_entity = ndb.Key('Sheriff', 'Chromium Perf Sheriff').get() 44 sheriff_entity = ndb.Key('Sheriff', 'Chromium Perf Sheriff').get()
43 anomaly_entity = anomaly.Anomaly( 45 anomaly_entity = anomaly.Anomaly(
44 median_before_anomaly=5.0, 46 median_before_anomaly=5.0,
45 median_after_anomaly=10.0, 47 median_after_anomaly=10.0,
46 start_revision=10002, 48 start_revision=10002,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 self.assertEqual(1, len(messages)) 139 self.assertEqual(1, len(messages))
138 self.assertIn(anomaly.FREAKIN_HUGE, str(messages[0].subject)) 140 self.assertIn(anomaly.FREAKIN_HUGE, str(messages[0].subject))
139 self.assertNotIn(str(sys.float_info.max), str(messages[0].body)) 141 self.assertNotIn(str(sys.float_info.max), str(messages[0].body))
140 self.assertIn(anomaly.FREAKIN_HUGE, str(messages[0].body)) 142 self.assertIn(anomaly.FREAKIN_HUGE, str(messages[0].body))
141 self.assertNotIn(str(sys.float_info.max), str(messages[0].html)) 143 self.assertNotIn(str(sys.float_info.max), str(messages[0].html))
142 self.assertIn(anomaly.FREAKIN_HUGE, str(messages[0].html)) 144 self.assertIn(anomaly.FREAKIN_HUGE, str(messages[0].html))
143 145
144 146
145 if __name__ == '__main__': 147 if __name__ == '__main__':
146 unittest.main() 148 unittest.main()
OLDNEW
« no previous file with comments | « dashboard/dashboard/edit_sheriffs_test.py ('k') | dashboard/dashboard/email_summary_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698