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.host_mock import MockHost | 7 from webkitpy.common.host_mock import MockHost |
8 from webkitpy.common.system.executive_mock import MockExecutive2 | 8 from webkitpy.common.system.executive_mock import MockExecutive2 |
9 from webkitpy.w3c.chromium_commit import ChromiumCommit | 9 from webkitpy.w3c.chromium_commit import ChromiumCommit |
10 from webkitpy.w3c.test_exporter import TestExporter | 10 from webkitpy.w3c.test_exporter import TestExporter |
11 from webkitpy.w3c.wpt_github_mock import MockWPTGitHub | 11 from webkitpy.w3c.wpt_github_mock import MockWPTGitHub |
12 | 12 |
13 | 13 |
14 def mock_command_exec(vals): | 14 def mock_command_exec(vals): |
15 def run_fn(args): | 15 def run_fn(args): |
16 sub_command = args[1] | 16 sub_command = args[1] |
17 return vals.get(sub_command, '') | 17 return vals.get(sub_command, '') |
18 return MockExecutive2(run_command_fn=run_fn) | 18 return MockExecutive2(run_command_fn=run_fn) |
19 | 19 |
20 | 20 |
21 | |
22 class TestExporterTest(unittest.TestCase): | 21 class TestExporterTest(unittest.TestCase): |
23 | 22 |
24 def setUp(self): | 23 def setUp(self): |
25 self.host = MockHost() | 24 self.host = MockHost() |
26 self.wpt_github = MockWPTGitHub(pull_requests=[]) | 25 self.wpt_github = MockWPTGitHub(pull_requests=[]) |
27 | 26 |
28 def test_stops_if_more_than_one_pr_is_in_flight(self): | 27 def test_stops_if_more_than_one_pr_is_in_flight(self): |
29 host = MockHost() | 28 host = MockHost() |
30 wpt_github = MockWPTGitHub(pull_requests=[{'id': 1}, {'id': 2}]) | 29 wpt_github = MockWPTGitHub(pull_requests=[{'id': 1}, {'id': 2}]) |
31 | 30 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 }) | 146 }) |
148 wpt_github = MockWPTGitHub(pull_requests=[]) | 147 wpt_github = MockWPTGitHub(pull_requests=[]) |
149 test_exporter = TestExporter(self.host, wpt_github) | 148 test_exporter = TestExporter(self.host, wpt_github) |
150 | 149 |
151 commits = test_exporter.exportable_commits_since('beefcafe') | 150 commits = test_exporter.exportable_commits_since('beefcafe') |
152 self.assertEqual(len(commits), 0) | 151 self.assertEqual(len(commits), 0) |
153 self.assertEqual(self.host.executive.calls, [ | 152 self.assertEqual(self.host.executive.calls, [ |
154 ['git', 'rev-parse', '--show-toplevel'], | 153 ['git', 'rev-parse', '--show-toplevel'], |
155 ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', 'badbeef8/t
hird_party/WebKit/LayoutTests/imported/wpt/'], | 154 ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', 'badbeef8/t
hird_party/WebKit/LayoutTests/imported/wpt/'], |
156 ['git', 'show', '--format=%B', '--no-patch', 'badbeef8']]) | 155 ['git', 'show', '--format=%B', '--no-patch', 'badbeef8']]) |
OLD | NEW |