Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f790b5518049c0b0c350307d0b92e72bdeefa627 |
| --- /dev/null |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py |
| @@ -0,0 +1,35 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import unittest |
| + |
| +from webkitpy.common.host_mock import MockHost |
| +from webkitpy.w3c.test_exporter import TestExporter |
| +from webkitpy.w3c.github import MockWPTGitHub |
| + |
| + |
| +class TestExporterTest(unittest.TestCase): |
| + |
| + 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
|
| + host = MockHost() |
| + mock_pull_requests = [{'id': 1}, {'id': 2}] |
| + 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
|
| + |
| + 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
|
| + |
| + def test_if_PR_exists_merges_it(self): |
| + host = MockHost() |
| + mock_pull_requests = [{'number': 1, 'title': 'abc'}] |
| + wpt_github = MockWPTGitHub(pull_requests=mock_pull_requests) |
| + TestExporter(host, wpt_github).run() |
| + |
| + self.assertEqual(len(wpt_github.calls), 2) |
| + self.assertEqual(wpt_github.calls[1], 'merge_pull_request') |
| + |
| + def test_merge_failure_errors_out(self): |
| + host = MockHost() |
| + mock_pull_requests = [{'number': 1, 'title': 'abc'}] |
| + wpt_github = MockWPTGitHub(pull_requests=mock_pull_requests, unsuccessful_merge=True) |
| + |
| + self.assertRaises(Exception, TestExporter(host, wpt_github).run) |