| 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 MockExecutive | 8 from webkitpy.common.system.executive_mock import MockExecutive |
| 9 from webkitpy.w3c.test_exporter import TestExporter | 9 from webkitpy.w3c.test_exporter import TestExporter |
| 10 from webkitpy.w3c.wpt_github_mock import MockWPTGitHub | 10 from webkitpy.w3c.wpt_github_mock import MockWPTGitHub |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 wpt_github = MockWPTGitHub(pull_requests=[{'number': 1, 'title': 'abc'}]
) | 46 wpt_github = MockWPTGitHub(pull_requests=[{'number': 1, 'title': 'abc'}]
) |
| 47 TestExporter(host, wpt_github, dry_run=True).run() | 47 TestExporter(host, wpt_github, dry_run=True).run() |
| 48 | 48 |
| 49 self.assertEqual(wpt_github.calls, ['in_flight_pull_requests']) | 49 self.assertEqual(wpt_github.calls, ['in_flight_pull_requests']) |
| 50 | 50 |
| 51 def test_creates_pull_request_for_earliest_commit(self): | 51 def test_creates_pull_request_for_earliest_commit(self): |
| 52 host = MockHost() | 52 host = MockHost() |
| 53 | 53 |
| 54 def mock_command(args): | 54 def mock_command(args): |
| 55 canned_git_outputs = { | 55 canned_git_outputs = { |
| 56 'show': 'newer fake text' if 'cafedad5' in args else 'older fake
text', | 56 'show': 'newer fake text' if 'add087a97844f4b9e307d9a216940582d9
6db306' in args else 'older fake text', |
| 57 'rev-list': 'facebeef\ncafedad5', | 57 'rev-list': 'c881563d734a86f7d9cd57ac509653a61c45c240\nadd087a97
844f4b9e307d9a216940582d96db306', |
| 58 'footers': 'fake-cr-position', | 58 'footers': 'fake-cr-position', |
| 59 'remote': 'github', | 59 'remote': 'github', |
| 60 'format-patch': 'fake patch', | 60 'format-patch': 'fake patch', |
| 61 'diff': 'fake patch diff', | 61 'diff': 'fake patch diff', |
| 62 'diff-tree': 'fake\n\files\nchanged', | 62 'diff-tree': 'fake\n\files\nchanged', |
| 63 'crrev-parse': 'c881563d734a86f7d9cd57ac509653a61c45c240', |
| 63 } | 64 } |
| 64 return canned_git_outputs.get(args[1], '') | 65 return canned_git_outputs.get(args[1], '') |
| 65 | 66 |
| 66 host.executive = MockExecutive(run_command_fn=mock_command) | 67 host.executive = MockExecutive(run_command_fn=mock_command) |
| 67 wpt_github = MockWPTGitHub(pull_requests=[]) | 68 wpt_github = MockWPTGitHub(pull_requests=[]) |
| 68 | 69 |
| 69 TestExporter(host, wpt_github).run() | 70 TestExporter(host, wpt_github).run() |
| 70 | 71 |
| 71 self.assertEqual(wpt_github.calls, ['in_flight_pull_requests', 'create_p
r']) | 72 self.assertEqual(wpt_github.calls, ['in_flight_pull_requests', 'create_p
r']) |
| 72 self.assertEqual(wpt_github.pull_requests_created, | 73 self.assertEqual(wpt_github.pull_requests_created, |
| 73 [('chromium-export-try', 'older fake text', 'older fake
text')]) | 74 [('chromium-export-try', 'older fake text', 'older fake
text')]) |
| OLD | NEW |