aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pygithub3/services/pull_requests/__init__.py21
-rw-r--r--pygithub3/tests/services/test_pull_requests.py4
2 files changed, 6 insertions, 19 deletions
diff --git a/pygithub3/services/pull_requests/__init__.py b/pygithub3/services/pull_requests/__init__.py
index f7da50a..66d9e58 100644
--- a/pygithub3/services/pull_requests/__init__.py
+++ b/pygithub3/services/pull_requests/__init__.py
@@ -95,23 +95,10 @@ class PullRequests(Service, MimeTypeMixin):
:param str repo: Repository
"""
- # for this to work with a proper Resource, we would need to pass the
- # response's status code to the Resource constructor, and that's kind
- # of scary
- try:
- resp = self._client.get(
- self.make_request('pull_requests.merge_status', number=number,
- user=user, repo=repo)
- )
- except NotFound:
- return False
- code = resp.status_code
- if code == 204:
- return True
- # TODO: more flexible way to return arbitrary objects based on
- # response. Probably something on Request
- raise BadRequest('got code %s: %s' % (code, resp.content))
- # again, I'm sorry.
+ return self._bool(
+ self.make_request('pull_requests.merge_status', number=number,
+ user=user, repo=repo)
+ )
def merge(self, number, message='', user=None, repo=None):
"""Merge a pull request.
diff --git a/pygithub3/tests/services/test_pull_requests.py b/pygithub3/tests/services/test_pull_requests.py
index 8071b09..7fc15b7 100644
--- a/pygithub3/tests/services/test_pull_requests.py
+++ b/pygithub3/tests/services/test_pull_requests.py
@@ -113,7 +113,7 @@ class TestPullRequestsService(TestCase):
self.assertEqual(True, resp)
self.assertEqual(
reqm.call_args[0],
- ('get', _('repos/user/repo/pulls/123/merge'))
+ ('head', _('repos/user/repo/pulls/123/merge'))
)
def test_MERGE_STATUS_false(self, reqm):
@@ -122,7 +122,7 @@ class TestPullRequestsService(TestCase):
self.assertEqual(False, resp)
self.assertEqual(
reqm.call_args[0],
- ('get', _('repos/user/repo/pulls/123/merge'))
+ ('head', _('repos/user/repo/pulls/123/merge'))
)
def test_MERGE(self, reqm):