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

Unified Diff: appengine/findit/handlers/test/culprit_test.py

Issue 2085513003: [Findit] Show the list of failed build cycles that a culprit is responsible for. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@group_same_failures
Patch Set: Add unittests. Created 4 years, 6 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 | « appengine/findit/handlers/culprit.py ('k') | appengine/findit/templates/waterfall/culprit.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/handlers/test/culprit_test.py
diff --git a/appengine/findit/handlers/test/culprit_test.py b/appengine/findit/handlers/test/culprit_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..ff705d5848c455f64649cc3553dab5a886b0ebba
--- /dev/null
+++ b/appengine/findit/handlers/test/culprit_test.py
@@ -0,0 +1,50 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from datetime import datetime
+
+import webapp2
+
+from testing_utils import testing
+
+from handlers import culprit
+from model import analysis_status as status
+from model.wf_culprit import WfCulprit
+
+
+class CulpritTest(testing.AppengineTestCase):
+ app_module = webapp2.WSGIApplication(
+ [('/culprit', culprit.Culprit), ], debug=True)
+
+ def testGetCulpritSuccess(self):
+ wf_culprit = WfCulprit.Create('chromium', 'r1')
+ wf_culprit.builds.append(['m', 'b1', 1])
+ wf_culprit.builds.append(['m', 'b2', 2])
+ wf_culprit.cr_notification_status = status.COMPLETED
+ wf_culprit.cr_notification_time = datetime(2016, 06, 24, 10, 03, 00)
+ wf_culprit.put()
+
+ expected_result = {
+ 'project_name': 'chromium',
+ 'revision': 'r1',
+ 'cr_notified': True,
+ 'cr_notification_time': '2016-06-24 10:03:00 UTC',
+ 'builds': [
+ {
+ 'master_name': 'm',
+ 'builder_name': 'b1',
+ 'build_number': 1,
+ },
+ {
+ 'master_name': 'm',
+ 'builder_name': 'b2',
+ 'build_number': 2,
+ },
+ ],
+ }
+
+ response = self.test_app.get(
+ '/culprit?key=%s&format=json' % wf_culprit.key.urlsafe())
+ self.assertEqual(200, response.status_int)
+ self.assertEqual(expected_result, response.json_body)
« no previous file with comments | « appengine/findit/handlers/culprit.py ('k') | appengine/findit/templates/waterfall/culprit.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698