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

Unified Diff: tests/git_cl_test.py

Issue 2274743003: Add a --json option to git cl try-results. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Add url and bucket, update test 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 | « git_cl.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/git_cl_test.py
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 9796b2bcb39430896f1985deba111aa3dd13f0e6..961801ed8ff7208b40981666d6b7cf41947ac951 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -1484,7 +1484,7 @@ class TestGitCl(TestCase):
})
self.calls.append(
((['ask_for_data', 'If you know what you are doing, '
- 'press Enter to continue, Ctrl+C to abort.'],), ''))
+ 'press Enter to continue, Ctrl+C to abort.'],), ''))
self.assertIsNone(cl.EnsureAuthenticated(force=False))
def test_gerrit_ensure_authenticated_ok(self):
@@ -1850,6 +1850,54 @@ class TestGitCl(TestCase):
out.getvalue(),
'scheduled CQ Dry Run on https://codereview.chromium.org/123\n')
+ def test_write_try_results_json(self):
+ builds = {
+ '9000': {
+ 'id': '9000',
+ 'status': 'STARTED',
+ 'url': 'http://build.cr.org/p/x.y/builders/my-builder/builds/2',
+ 'result_details_json': '{"properties": {}}',
+ 'bucket': 'master.x.y',
+ 'created_by': 'user:someone@chromium.org',
+ 'created_ts': '147200002222000',
+ 'parameters_json': '{"builder_name": "my-builder", "category": ""}',
+ },
+ '8000': {
+ 'id': '8000',
+ 'status': 'COMPLETED',
+ 'result': 'FAILURE',
+ 'failure_reason': 'BUILD_FAILURE',
+ 'url': 'http://build.cr.org/p/x.y/builders/my-builder/builds/1',
+ 'result_details_json': '{"properties": {}}',
+ 'bucket': 'master.x.y',
+ 'created_by': 'user:someone@chromium.org',
+ 'created_ts': '147200001111000',
+ 'parameters_json': '{"builder_name": "my-builder", "category": ""}',
+ },
+ }
+ expected_output = [
+ {
+ 'buildbucket_id': '8000',
+ 'bucket': 'master.x.y',
+ 'builder_name': 'my-builder',
+ 'status': 'COMPLETED',
+ 'result': 'FAILURE',
+ 'failure_reason': 'BUILD_FAILURE',
+ 'url': 'http://build.cr.org/p/x.y/builders/my-builder/builds/1',
+ },
+ {
+ 'buildbucket_id': '9000',
+ 'bucket': 'master.x.y',
+ 'builder_name': 'my-builder',
+ 'status': 'STARTED',
+ 'result': None,
+ 'failure_reason': None,
+ 'url': 'http://build.cr.org/p/x.y/builders/my-builder/builds/2',
+ }
+ ]
+ self.calls = [(('write_json', 'output.json', expected_output), '')]
+ git_cl.write_try_results_json('output.json', builds)
+
def _common_GerritCommitMsgHookCheck(self):
self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
self.mock(git_cl.os.path, 'abspath',
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698