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

Unified Diff: dashboard/dashboard/edit_sheriffs_test.py

Issue 3020453002: Dashboard - Add more logging around Sheriffs and alert creation. (Closed)
Patch Set: Fix test. Created 3 years, 3 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/edit_config_handler.py ('k') | dashboard/dashboard/find_anomalies.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/edit_sheriffs_test.py
diff --git a/dashboard/dashboard/edit_sheriffs_test.py b/dashboard/dashboard/edit_sheriffs_test.py
index 49efade973ada96b39603f610812a85cb921d9cc..b604113a80442520ac84fd1ecfeb4e4bb37c1efc 100644
--- a/dashboard/dashboard/edit_sheriffs_test.py
+++ b/dashboard/dashboard/edit_sheriffs_test.py
@@ -213,6 +213,41 @@ class EditSheriffsTest(testing_common.TestCase):
actual = self.GetEmbeddedVariable(response, 'SHERIFF_DATA')
self.assertEqual(expected, actual)
+ def testPost_SendsNotificationEmail(self):
+ self._AddSampleTestData()
+ self._AddSheriff('Chromium Perf Sheriff', patterns=['*/*/*/*'])
+ self.testapp.post('/edit_sheriffs', {
+ 'add-edit': 'edit',
+ 'edit-name': 'Chromium Perf Sheriff',
+ 'patterns': '*/*/*/ddd\n\n*/*/*/ccc',
+ 'xsrf_token': xsrf.GenerateToken(users.get_current_user()),
+ })
+ sheriff_entity = sheriff.Sheriff.query().fetch()[0]
+ self.assertEqual(['*/*/*/ccc', '*/*/*/ddd'], sheriff_entity.patterns)
+
+ messages = self.mail_stub.get_sent_messages()
+ self.assertEqual(1, len(messages))
+ self.assertEqual('gasper-alerts@google.com', messages[0].sender)
+ self.assertEqual('chrome-performance-monitoring-alerts@google.com',
+ messages[0].to)
+ self.assertEqual(
+ 'Added or updated Sheriff: Chromium Perf Sheriff by foo@bar.com',
+ messages[0].subject)
+ expected_email = """The configuration of None was changed by foo@bar.com.
+
+Key: Chromium Perf Sheriff
+
+Added test paths:
+[]
+
+Removed test paths:
+[
+ "TheMaster/TheBot/Suite1/bbb",
+ "TheMaster/TheBot/Suite1/aaa"
+]"""
+ print messages[0].body
+ self.assertIn(expected_email, str(messages[0].body))
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « dashboard/dashboard/edit_config_handler.py ('k') | dashboard/dashboard/find_anomalies.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698