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

Side by Side Diff: appengine/findit/handlers/test/culprit_test.py

Issue 2116073002: [Findit] Fix redirect bug and update template for waterfall/culprit. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Add one unittest. 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 | « appengine/findit/handlers/culprit.py ('k') | appengine/findit/main.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 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 from datetime import datetime 5 from datetime import datetime
6 6
7 import webapp2 7 import webapp2
8 8
9 from testing_utils import testing 9 from testing_utils import testing
10 10
11 from handlers import culprit 11 from handlers import culprit
12 from model import analysis_status as status 12 from model import analysis_status as status
13 from model.wf_culprit import WfCulprit 13 from model.wf_culprit import WfCulprit
14 14
15 15
16 class CulpritTest(testing.AppengineTestCase): 16 class CulpritTest(testing.AppengineTestCase):
17 app_module = webapp2.WSGIApplication( 17 app_module = webapp2.WSGIApplication(
18 [('/culprit', culprit.Culprit), ], debug=True) 18 [('/culprit', culprit.Culprit), ], debug=True)
19 19
20 def testGetCulpritSuccess(self): 20 def testGetCulpritSuccess(self):
21 wf_culprit = WfCulprit.Create('chromium', 'r1') 21 wf_culprit = WfCulprit.Create('chromium', 'r1', 123)
22 wf_culprit.builds.append(['m', 'b1', 1]) 22 wf_culprit.builds.append(['m', 'b1', 1])
23 wf_culprit.builds.append(['m', 'b2', 2]) 23 wf_culprit.builds.append(['m', 'b2', 2])
24 wf_culprit.cr_notification_status = status.COMPLETED 24 wf_culprit.cr_notification_status = status.COMPLETED
25 wf_culprit.cr_notification_time = datetime(2016, 06, 24, 10, 03, 00) 25 wf_culprit.cr_notification_time = datetime(2016, 06, 24, 10, 03, 00)
26 wf_culprit.put() 26 wf_culprit.put()
27 27
28 expected_result = { 28 expected_result = {
29 'project_name': 'chromium', 29 'project_name': 'chromium',
30 'revision': 'r1', 30 'revision': 'r1',
31 'commit_position': 123,
31 'cr_notified': True, 32 'cr_notified': True,
32 'cr_notification_time': '2016-06-24 10:03:00 UTC', 33 'cr_notification_time': '2016-06-24 10:03:00 UTC',
33 'builds': [ 34 'builds': [
34 { 35 {
35 'master_name': 'm', 36 'master_name': 'm',
36 'builder_name': 'b1', 37 'builder_name': 'b1',
37 'build_number': 1, 38 'build_number': 1,
38 }, 39 },
39 { 40 {
40 'master_name': 'm', 41 'master_name': 'm',
41 'builder_name': 'b2', 42 'builder_name': 'b2',
42 'build_number': 2, 43 'build_number': 2,
43 }, 44 },
44 ], 45 ],
46 'key': wf_culprit.key.urlsafe(),
45 } 47 }
46 48
47 response = self.test_app.get( 49 response = self.test_app.get(
48 '/culprit?key=%s&format=json' % wf_culprit.key.urlsafe()) 50 '/culprit?key=%s&format=json' % wf_culprit.key.urlsafe())
49 self.assertEqual(200, response.status_int) 51 self.assertEqual(200, response.status_int)
50 self.assertEqual(expected_result, response.json_body) 52 self.assertEqual(expected_result, response.json_body)
OLDNEW
« no previous file with comments | « appengine/findit/handlers/culprit.py ('k') | appengine/findit/main.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698