Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import unittest | |
| 6 | |
| 7 from webkitpy.common.host_mock import MockHost | |
| 8 from webkitpy.w3c.test_exporter import TestExporter | |
| 9 from webkitpy.w3c.github import MockWPTGitHub | |
| 10 | |
| 11 | |
| 12 class TestExporterTest(unittest.TestCase): | |
| 13 | |
| 14 def test_stops_if_more_than_one_PR_is_in_flight(self): | |
|
qyearsley
2016/11/22 22:08:20
The linter might complain about capitals in the na
| |
| 15 host = MockHost() | |
| 16 mock_pull_requests = [{'id': 1}, {'id': 2}] | |
| 17 wpt_github = MockWPTGitHub(pull_requests=mock_pull_requests) | |
|
qyearsley
2016/11/22 22:08:20
You could also pass the literal list of mock pull
| |
| 18 | |
| 19 self.assertRaises(Exception, TestExporter(host, wpt_github)) | |
|
qyearsley
2016/11/22 22:08:20
An alternate way of expressing this that I've seen
jeffcarp
2016/11/22 22:30:15
Hell yes that looks much nicer
| |
| 20 | |
| 21 def test_if_PR_exists_merges_it(self): | |
| 22 host = MockHost() | |
| 23 mock_pull_requests = [{'number': 1, 'title': 'abc'}] | |
| 24 wpt_github = MockWPTGitHub(pull_requests=mock_pull_requests) | |
| 25 TestExporter(host, wpt_github).run() | |
| 26 | |
| 27 self.assertEqual(len(wpt_github.calls), 2) | |
| 28 self.assertEqual(wpt_github.calls[1], 'merge_pull_request') | |
| 29 | |
| 30 def test_merge_failure_errors_out(self): | |
| 31 host = MockHost() | |
| 32 mock_pull_requests = [{'number': 1, 'title': 'abc'}] | |
| 33 wpt_github = MockWPTGitHub(pull_requests=mock_pull_requests, unsuccessfu l_merge=True) | |
| 34 | |
| 35 self.assertRaises(Exception, TestExporter(host, wpt_github).run) | |
| OLD | NEW |