| OLD | NEW |
| 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 import unittest | 5 import unittest |
| 6 | 6 |
| 7 from webkitpy.common.net.git_cl import GitCL | 7 from webkitpy.common.net.git_cl import GitCL |
| 8 from webkitpy.common.system.executive_mock import MockExecutive | 8 from webkitpy.common.system.executive_mock import MockExecutive |
| 9 from webkitpy.common.host_mock import MockHost | 9 from webkitpy.common.host_mock import MockHost |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 host.executive = MockExecutive(output='Issue number: 12345 (http://crrev
.com/12345)') | 40 host.executive = MockExecutive(output='Issue number: 12345 (http://crrev
.com/12345)') |
| 41 git_cl = GitCL(host) | 41 git_cl = GitCL(host) |
| 42 self.assertEqual(git_cl.get_issue_number(), '12345') | 42 self.assertEqual(git_cl.get_issue_number(), '12345') |
| 43 | 43 |
| 44 def test_get_issue_number_none(self): | 44 def test_get_issue_number_none(self): |
| 45 host = MockHost() | 45 host = MockHost() |
| 46 host.executive = MockExecutive(output='Issue number: None (None)') | 46 host.executive = MockExecutive(output='Issue number: None (None)') |
| 47 git_cl = GitCL(host) | 47 git_cl = GitCL(host) |
| 48 self.assertEqual(git_cl.get_issue_number(), 'None') | 48 self.assertEqual(git_cl.get_issue_number(), 'None') |
| 49 | 49 |
| 50 def test_is_closed_true(self): | |
| 51 host = MockHost() | |
| 52 host.executive = MockExecutive(output='closed ') | |
| 53 git_cl = GitCL(host) | |
| 54 self.assertTrue(git_cl.is_closed()) | |
| 55 | |
| 56 def test_is_closed_false(self): | |
| 57 host = MockHost() | |
| 58 host.executive = MockExecutive(output='waiting') | |
| 59 git_cl = GitCL(host) | |
| 60 self.assertFalse(git_cl.is_closed()) | |
| 61 | |
| 62 def test_all_jobs_finished_empty(self): | 50 def test_all_jobs_finished_empty(self): |
| 63 self.assertTrue(GitCL.all_jobs_finished([])) | 51 self.assertTrue(GitCL.all_jobs_finished([])) |
| 64 | 52 |
| 65 def test_wait_for_try_jobs_time_out(self): | 53 def test_wait_for_try_jobs_time_out(self): |
| 66 host = MockHost() | 54 host = MockHost() |
| 67 git_cl = GitCL(host) | 55 git_cl = GitCL(host) |
| 68 git_cl.fetch_try_results = lambda: [ | 56 git_cl.fetch_try_results = lambda: [ |
| 69 { | 57 { |
| 70 'builder_name': 'some-builder', | 58 'builder_name': 'some-builder', |
| 71 'status': 'STARTED', | 59 'status': 'STARTED', |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 ])) | 134 ])) |
| 147 | 135 |
| 148 def test_has_failing_try_results_with_failing_results(self): | 136 def test_has_failing_try_results_with_failing_results(self): |
| 149 self.assertTrue(GitCL.has_failing_try_results([ | 137 self.assertTrue(GitCL.has_failing_try_results([ |
| 150 { | 138 { |
| 151 'builder_name': 'some-builder', | 139 'builder_name': 'some-builder', |
| 152 'status': 'COMPLETED', | 140 'status': 'COMPLETED', |
| 153 'result': 'FAILURE', | 141 'result': 'FAILURE', |
| 154 }, | 142 }, |
| 155 ])) | 143 ])) |
| OLD | NEW |