Add draft attribute, update test

This commit is contained in:
MarcoFalke
2020-03-09 12:20:12 +05:30
committed by Anuj Bansal
parent bfeacded4e
commit bd28524853
2 changed files with 12 additions and 0 deletions
+11
View File
@@ -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"]
+1
View File
@@ -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(