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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py

Issue 2605873004: Unify MockExecutive and MockExecutive2. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 MockExecutive2 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
11 11
12 class GitCLTest(unittest.TestCase): 12 class GitCLTest(unittest.TestCase):
13 13
14 def test_run(self): 14 def test_run(self):
15 host = MockHost() 15 host = MockHost()
16 host.executive = MockExecutive2(output='mock-output') 16 host.executive = MockExecutive(output='mock-output')
17 git_cl = GitCL(host) 17 git_cl = GitCL(host)
18 output = git_cl.run(['command']) 18 output = git_cl.run(['command'])
19 self.assertEqual(output, 'mock-output') 19 self.assertEqual(output, 'mock-output')
20 self.assertEqual(host.executive.calls, [['git', 'cl', 'command']]) 20 self.assertEqual(host.executive.calls, [['git', 'cl', 'command']])
21 21
22 def test_run_with_auth(self): 22 def test_run_with_auth(self):
23 host = MockHost() 23 host = MockHost()
24 host.executive = MockExecutive2(output='mock-output') 24 host.executive = MockExecutive(output='mock-output')
25 git_cl = GitCL(host, auth_refresh_token_json='token.json') 25 git_cl = GitCL(host, auth_refresh_token_json='token.json')
26 git_cl.run(['upload']) 26 git_cl.run(['upload'])
27 self.assertEqual( 27 self.assertEqual(
28 host.executive.calls, 28 host.executive.calls,
29 [['git', 'cl', 'upload', '--auth-refresh-token-json', 'token.json']] ) 29 [['git', 'cl', 'upload', '--auth-refresh-token-json', 'token.json']] )
30 30
31 def test_some_commands_not_run_with_auth(self): 31 def test_some_commands_not_run_with_auth(self):
32 host = MockHost() 32 host = MockHost()
33 host.executive = MockExecutive2(output='mock-output') 33 host.executive = MockExecutive(output='mock-output')
34 git_cl = GitCL(host, auth_refresh_token_json='token.json') 34 git_cl = GitCL(host, auth_refresh_token_json='token.json')
35 git_cl.run(['issue']) 35 git_cl.run(['issue'])
36 self.assertEqual(host.executive.calls, [['git', 'cl', 'issue']]) 36 self.assertEqual(host.executive.calls, [['git', 'cl', 'issue']])
37 37
38 def test_get_issue_number(self): 38 def test_get_issue_number(self):
39 host = MockHost() 39 host = MockHost()
40 host.executive = MockExecutive2(output='Issue number: 12345 (http://crre v.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 = MockExecutive2(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_all_jobs_finished_empty(self): 50 def test_all_jobs_finished_empty(self):
51 self.assertTrue(GitCL.all_jobs_finished([])) 51 self.assertTrue(GitCL.all_jobs_finished([]))
52 52
53 def test_all_jobs_finished_with_started_jobs(self): 53 def test_all_jobs_finished_with_started_jobs(self):
54 self.assertFalse(GitCL.all_jobs_finished([ 54 self.assertFalse(GitCL.all_jobs_finished([
55 { 55 {
56 'builder_name': 'some-builder', 56 'builder_name': 'some-builder',
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 ])) 96 ]))
97 97
98 def test_has_failing_try_results_with_failing_results(self): 98 def test_has_failing_try_results_with_failing_results(self):
99 self.assertTrue(GitCL.has_failing_try_results([ 99 self.assertTrue(GitCL.has_failing_try_results([
100 { 100 {
101 'builder_name': 'some-builder', 101 'builder_name': 'some-builder',
102 'status': 'COMPLETED', 102 'status': 'COMPLETED',
103 'result': 'FAILURE', 103 'result': 'FAILURE',
104 }, 104 },
105 ])) 105 ]))
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698