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

Side by Side 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 unified diff | 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 »
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 unittest 5 import unittest
6 6
7 import webapp2 7 import webapp2
8 import webtest 8 import webtest
9 9
10 from google.appengine.api import users 10 from google.appengine.api import users
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 'email': '', 206 'email': '',
207 'internal_only': False, 207 'internal_only': False,
208 'labels': 'hello,world', 208 'labels': 'hello,world',
209 'summarize': True, 209 'summarize': True,
210 'patterns': 'a/b/c\nx/y/z', 210 'patterns': 'a/b/c\nx/y/z',
211 }, 211 },
212 } 212 }
213 actual = self.GetEmbeddedVariable(response, 'SHERIFF_DATA') 213 actual = self.GetEmbeddedVariable(response, 'SHERIFF_DATA')
214 self.assertEqual(expected, actual) 214 self.assertEqual(expected, actual)
215 215
216 def testPost_SendsNotificationEmail(self):
217 self._AddSampleTestData()
218 self._AddSheriff('Chromium Perf Sheriff', patterns=['*/*/*/*'])
219 self.testapp.post('/edit_sheriffs', {
220 'add-edit': 'edit',
221 'edit-name': 'Chromium Perf Sheriff',
222 'patterns': '*/*/*/ddd\n\n*/*/*/ccc',
223 'xsrf_token': xsrf.GenerateToken(users.get_current_user()),
224 })
225 sheriff_entity = sheriff.Sheriff.query().fetch()[0]
226 self.assertEqual(['*/*/*/ccc', '*/*/*/ddd'], sheriff_entity.patterns)
227
228 messages = self.mail_stub.get_sent_messages()
229 self.assertEqual(1, len(messages))
230 self.assertEqual('gasper-alerts@google.com', messages[0].sender)
231 self.assertEqual('chrome-performance-monitoring-alerts@google.com',
232 messages[0].to)
233 self.assertEqual(
234 'Added or updated Sheriff: Chromium Perf Sheriff by foo@bar.com',
235 messages[0].subject)
236 expected_email = """The configuration of None was changed by foo@bar.com.
237
238 Key: Chromium Perf Sheriff
239
240 Added test paths:
241 []
242
243 Removed test paths:
244 [
245 "TheMaster/TheBot/Suite1/bbb",
246 "TheMaster/TheBot/Suite1/aaa"
247 ]"""
248 print messages[0].body
249 self.assertIn(expected_email, str(messages[0].body))
250
216 251
217 if __name__ == '__main__': 252 if __name__ == '__main__':
218 unittest.main() 253 unittest.main()
OLDNEW
« 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