Chromium Code Reviews| Index: tests/git_cl_test.py |
| diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py |
| index 9796b2bcb39430896f1985deba111aa3dd13f0e6..f7aabca98051ddc25d07abf53c7be9c633b4d47b 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,50 @@ 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"}', |
| + }, |
| + '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"}', |
| + }, |
| + } |
| + expected_output = [ |
| + { |
| + 'buildbucket_id': '8000', |
| + 'builder_name': 'my-builder', |
| + 'status': 'COMPLETED', |
| + 'result': 'FAILURE', |
| + 'failure_reason': 'BUILD_FAILURE', |
| + }, |
| + { |
| + 'buildbucket_id': '9000', |
| + 'builder_name': 'my-builder', |
| + 'status': 'STARTED', |
| + 'result': None, |
| + 'failure_reason': None, |
| + } |
| + ] |
| + self.calls = [(('write_json', 'output.json', expected_output), '')] |
| + git_cl.write_try_results_json('output.json', builds) |
|
qyearsley
2016/08/30 22:13:22
I'm not sure whether it would be worth it to write
tandrii(chromium)
2016/08/30 22:22:45
I'd keep more specific here, but it'd still have a
qyearsley
2016/08/30 23:41:25
Alright, sounds reasonable ^^
|
| + |
| def _common_GerritCommitMsgHookCheck(self): |
| self.mock(git_cl.sys, 'stdout', StringIO.StringIO()) |
| self.mock(git_cl.os.path, 'abspath', |