Chromium Code Reviews| 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 ') | |
|
jeffcarp
2017/02/06 22:58:45
Should there be a space at the end of closed?
qyearsley
2017/02/06 23:15:38
I put that there to test whether it's OK to have w
| |
| 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 | |
| 50 def test_all_jobs_finished_empty(self): | 62 def test_all_jobs_finished_empty(self): |
| 51 self.assertTrue(GitCL.all_jobs_finished([])) | 63 self.assertTrue(GitCL.all_jobs_finished([])) |
| 52 | 64 |
| 53 def test_wait_for_try_jobs_time_out(self): | 65 def test_wait_for_try_jobs_time_out(self): |
| 54 host = MockHost() | 66 host = MockHost() |
| 55 git_cl = GitCL(host) | 67 git_cl = GitCL(host) |
| 56 git_cl.fetch_try_results = lambda: [ | 68 git_cl.fetch_try_results = lambda: [ |
| 57 { | 69 { |
| 58 'builder_name': 'some-builder', | 70 'builder_name': 'some-builder', |
| 59 'status': 'STARTED', | 71 'status': 'STARTED', |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 ])) | 146 ])) |
| 135 | 147 |
| 136 def test_has_failing_try_results_with_failing_results(self): | 148 def test_has_failing_try_results_with_failing_results(self): |
| 137 self.assertTrue(GitCL.has_failing_try_results([ | 149 self.assertTrue(GitCL.has_failing_try_results([ |
| 138 { | 150 { |
| 139 'builder_name': 'some-builder', | 151 'builder_name': 'some-builder', |
| 140 'status': 'COMPLETED', | 152 'status': 'COMPLETED', |
| 141 'result': 'FAILURE', | 153 'result': 'FAILURE', |
| 142 }, | 154 }, |
| 143 ])) | 155 ])) |
| OLD | NEW |