mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Merge pull request #1427 from ahhda/list_draft_pull_request
Add draft attribute to PullRequest
This commit is contained in:
@@ -181,6 +181,14 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
self._completeIfNotSet(self._diff_url)
|
||||
return self._diff_url.value
|
||||
|
||||
@property
|
||||
def draft(self):
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
self._completeIfNotSet(self._draft)
|
||||
return self._draft.value
|
||||
|
||||
@property
|
||||
def head(self):
|
||||
"""
|
||||
@@ -924,6 +932,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._deletions = github.GithubObject.NotSet
|
||||
self._diff_url = github.GithubObject.NotSet
|
||||
self._draft = github.GithubObject.NotSet
|
||||
self._head = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
@@ -991,6 +1000,8 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
self._deletions = self._makeIntAttribute(attributes["deletions"])
|
||||
if "diff_url" in attributes: # pragma no branch
|
||||
self._diff_url = self._makeStringAttribute(attributes["diff_url"])
|
||||
if "draft" in attributes: # pragma no branch
|
||||
self._draft = self._makeBoolAttribute(attributes["draft"])
|
||||
if "head" in attributes: # pragma no branch
|
||||
self._head = self._makeClassAttribute(
|
||||
github.PullRequestPart.PullRequestPart, attributes["head"]
|
||||
|
||||
@@ -133,6 +133,7 @@ class PullRequest(Framework.TestCase):
|
||||
self.pull.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/31"
|
||||
)
|
||||
self.assertEqual(self.pull.user.login, "jacquev6")
|
||||
self.assertEqual(self.pull.draft, None)
|
||||
|
||||
# test __repr__() based on this attributes
|
||||
self.assertEqual(
|
||||
|
||||
Reference in New Issue
Block a user