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

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

Issue 2259513003: [Findit] Display last build bucket response to try job dashboard (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 4 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 | « no previous file | appengine/findit/handlers/try_job_dashboard.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/handlers/test/try_job_dashboard_test.py
diff --git a/appengine/findit/handlers/test/try_job_dashboard_test.py b/appengine/findit/handlers/test/try_job_dashboard_test.py
index cd1a5668deb6f844a7c9a685897b9a5b28dcb45c..3305bfc6d7f2994faf6fce901beb61e34beef682 100644
--- a/appengine/findit/handlers/test/try_job_dashboard_test.py
+++ b/appengine/findit/handlers/test/try_job_dashboard_test.py
@@ -4,6 +4,8 @@
from datetime import datetime
from datetime import timedelta
+import json
+
import webapp2
from handlers import try_job_dashboard
@@ -48,6 +50,31 @@ class TryJobDashboardTest(testing.AppengineTestCase):
datetime(2016, 1, 2, 1, 2, 4)),
'00:00:01')
+ def testPrepareBuildbucketResponseForDisplayNoData(self):
+ self.assertEqual(
+ try_job_dashboard._PrepareBuildbucketResponseForDisplay(None),
+ None)
+ self.assertEqual(
+ try_job_dashboard._PrepareBuildbucketResponseForDisplay({}),
+ {})
+
+ def testPrepareBuildbucketResponseForDisplayWithJson(self):
+ properties = {
+ 'a': 1,
+ 'b': 2
+ }
+ buildbucket_response = {
+ 'has_json': json.dumps(properties),
+ 'blabla': 'blabla'
+ }
+ self.assertEqual(
+ try_job_dashboard._PrepareBuildbucketResponseForDisplay(
+ buildbucket_response),
+ {
+ 'blabla': 'blabla',
+ 'has_json': properties
+ })
+
def testGet(self):
try_job_in_progress = WfTryJobData.Create(1)
try_job_in_progress.master_name = 'm'
@@ -57,6 +84,7 @@ class TryJobDashboardTest(testing.AppengineTestCase):
try_job_in_progress.start_time = datetime(2016, 5, 4, 0, 0, 1)
try_job_in_progress.request_time = datetime(2016, 5, 4, 0, 0, 0)
try_job_in_progress.try_job_url = 'url1'
+ try_job_in_progress.last_buildbucket_response = {'status': 'STARTED'}
try_job_in_progress.put()
try_job_with_error = WfTryJobData.Create(2)
@@ -72,6 +100,9 @@ class TryJobDashboardTest(testing.AppengineTestCase):
'message': 'some error',
'reason': 'some reason'
}
+ try_job_with_error.last_buildbucket_response = {
+ 'failure_reason': 'INFRA_FAILURE'
+ }
try_job_with_error.put()
try_job_completed = WfTryJobData.Create(3)
@@ -88,6 +119,9 @@ class TryJobDashboardTest(testing.AppengineTestCase):
'12345': 'failed'
}
}
+ try_job_completed.last_buildbucket_response = {
+ 'status': 'COMPLETED'
+ }
try_job_completed.put()
expected_try_job_in_progress_display_data = {
@@ -97,7 +131,8 @@ class TryJobDashboardTest(testing.AppengineTestCase):
'try_job_type': 'compile',
'request_time': '2016-05-04 00:00:00 UTC',
'try_job_url': 'url1',
- 'status': 'running'
+ 'status': 'running',
+ 'last_buildbucket_response': '{"status": "STARTED"}'
}
expected_try_job_with_error_display_data = {
@@ -108,6 +143,7 @@ class TryJobDashboardTest(testing.AppengineTestCase):
'request_time': '2016-05-04 00:00:00 UTC',
'try_job_url': 'url2',
'error': 'some error',
+ 'last_buildbucket_response': '{"failure_reason": "INFRA_FAILURE"}'
}
expected_try_job_completed_display_data = {
@@ -117,7 +153,8 @@ class TryJobDashboardTest(testing.AppengineTestCase):
'try_job_type': 'compile',
'request_time': '2016-05-04 00:00:00 UTC',
'try_job_url': 'url3',
- 'culprit_found': True
+ 'culprit_found': True,
+ 'last_buildbucket_response': '{"status": "COMPLETED"}'
}
response = self.test_app.get(
@@ -138,4 +175,3 @@ class TryJobDashboardTest(testing.AppengineTestCase):
self.validateTryJobDisplayData(
[expected_try_job_completed_display_data],
successfully_completed_try_jobs)
-
« no previous file with comments | « no previous file | appengine/findit/handlers/try_job_dashboard.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698