Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github_mock.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github_mock.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..27fb6b1fe5df1c93e013d07cbc6b30ffc50ddfc9 |
| --- /dev/null |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github_mock.py |
| @@ -0,0 +1,34 @@ |
| +class MockWPTGitHub(object): |
| + |
| + def __init__(self, pull_requests, unsuccessful_merge=False): |
| + self.pull_requests = pull_requests |
| + self.unsuccessful_merge = unsuccessful_merge |
| + self.calls = [] |
| + self.pull_requests_created = [] |
| + |
| + def in_flight_pull_requests(self): |
| + self.calls.append('in_flight_pull_requests') |
| + return self.pull_requests |
| + |
| + def merge_pull_request(self, number): |
| + self.calls.append('merge_pull_request') |
| + if self.unsuccessful_merge: |
| + raise Exception('PR could not be merged: %d' % number) |
| + |
| + def create_pr(self, local_branch_name, desc_title, body): |
| + """Creates a PR on GitHub. |
|
foolip
2016/11/29 11:12:21
Copying the documentation here doesn't seem useful
|
| + |
| + API doc: https://developer.github.com/v3/pulls/#create-a-pull-request |
| + |
| + Returns: |
| + A raw response object if successful, None if not. |
| + """ |
| + self.calls.append('create_pr') |
| + |
| + assert local_branch_name |
| + assert desc_title |
| + assert body |
| + |
| + self.pull_requests_created.append((local_branch_name, desc_title, body)) |
| + |
| + return {} |