Include target_commitish in GitRelease (#788)

This commit is contained in:
Maarten Fonville
2018-05-21 17:20:18 +08:00
committed by Wan Liuyang
parent 286272aaf1
commit ba5bf2d76a
2 changed files with 12 additions and 0 deletions
+11
View File
@@ -77,6 +77,14 @@ class GitRelease(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._tag_name)
return self._tag_name.value
@property
def target_commitish(self):
"""
:type: string
"""
self._completeIfNotSet(self._target_commitish)
return self._target_commitish.value
@property
def draft(self):
"""
@@ -216,6 +224,7 @@ class GitRelease(github.GithubObject.CompletableGithubObject):
self._body = github.GithubObject.NotSet
self._title = github.GithubObject.NotSet
self._tag_name = github.GithubObject.NotSet
self._target_commitish = github.GithubObject.NotSet
self._draft = github.GithubObject.NotSet
self._prerelease = github.GithubObject.NotSet
self._author = github.GithubObject.NotSet
@@ -236,6 +245,8 @@ class GitRelease(github.GithubObject.CompletableGithubObject):
self._title = self._makeStringAttribute(attributes["name"])
if "tag_name" in attributes:
self._tag_name = self._makeStringAttribute(attributes["tag_name"])
if "target_commitish" in attributes:
self._target_commitish = self._makeStringAttribute(attributes["target_commitish"])
if "draft" in attributes:
self._draft = self._makeBoolAttribute(attributes["draft"])
if "prerelease" in attributes:
+1
View File
@@ -62,6 +62,7 @@ class Release(Framework.TestCase):
self.release = self.g.get_user().get_repo("PyGithub").get_releases()[0]
self.assertEqual(self.release.id, 1210814)
self.assertEqual(self.release.tag_name, "v1.25.2")
self.assertEqual(self.release.target_commitish, "master")
self.assertEqual(self.release.upload_url, "https://uploads.github.com/repos/edhollandAL/PyGithub/releases/1210814/assets{?name}")
self.assertEqual(self.release.body, "Body")
self.assertEqual(self.release.title, "Test")