From 0f0a7d4e68e5b61ed01be888ddfcac0c2e07d4d4 Mon Sep 17 00:00:00 2001 From: Shinichi TAMURA Date: Thu, 15 Mar 2018 12:17:04 +0900 Subject: [PATCH] Added target_commitish option to Repository.create_git_release() (#625) * Added is_draft and is_prerelease property to GitRelease * Added target_commitish option to Repository.create_git_release() * Added test for Repository.create_git_release() * Renamed attr of GitRelease: is_draft, is_prerelease -> draft, prerelease --- github/GitRelease.py | 22 +++++++++++++ github/Repository.py | 9 ++++- github/tests/GitRelease.py | 2 ++ .../Repository.testCreateGitRelease.txt | 11 +++++++ ...y.testCreateGitReleaseWithAllArguments.txt | 33 +++++++++++++++++++ github/tests/Repository.py | 29 ++++++++++++++++ 6 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 github/tests/ReplayData/Repository.testCreateGitRelease.txt create mode 100644 github/tests/ReplayData/Repository.testCreateGitReleaseWithAllArguments.txt diff --git a/github/GitRelease.py b/github/GitRelease.py index 775f016e..4f08e7b5 100644 --- a/github/GitRelease.py +++ b/github/GitRelease.py @@ -68,6 +68,22 @@ class GitRelease(github.GithubObject.CompletableGithubObject): self._completeIfNotSet(self._tag_name) return self._tag_name.value + @property + def draft(self): + """ + :type: bool + """ + self._completeIfNotSet(self._draft) + return self._draft.value + + @property + def prerelease(self): + """ + :type: bool + """ + self._completeIfNotSet(self._prerelease) + return self._prerelease.value + @property def author(self): """ @@ -175,6 +191,8 @@ class GitRelease(github.GithubObject.CompletableGithubObject): self._body = github.GithubObject.NotSet self._title = github.GithubObject.NotSet self._tag_name = github.GithubObject.NotSet + self._draft = github.GithubObject.NotSet + self._prerelease = github.GithubObject.NotSet self._author = github.GithubObject.NotSet self._url = github.GithubObject.NotSet self._upload_url = github.GithubObject.NotSet @@ -191,6 +209,10 @@ 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 "draft" in attributes: + self._draft = self._makeBoolAttribute(attributes["draft"]) + if "prerelease" in attributes: + self._prerelease = self._makeBoolAttribute(attributes["prerelease"]) if "author" in attributes: self._author = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["author"]) if "url" in attributes: diff --git a/github/Repository.py b/github/Repository.py index 95152445..5644f63a 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -787,12 +787,13 @@ class Repository(github.GithubObject.CompletableGithubObject): self.create_git_tag(tag, tag_message, object, type, tagger) return self.create_git_release(tag, release_name, release_message, draft, prerelease) - def create_git_release(self, tag, name, message, draft=False, prerelease=False): + def create_git_release(self, tag, name, message, draft=False, prerelease=False, target_commitish=github.GithubObject.NotSet): assert isinstance(tag, (str, unicode)), tag assert isinstance(name, (str, unicode)), name assert isinstance(message, (str, unicode)), message assert isinstance(draft, bool), draft assert isinstance(prerelease, bool), prerelease + assert target_commitish is github.GithubObject.NotSet or isinstance(target_commitish, (str, unicode, github.Branch.Branch, github.Commit.Commit, github.GitCommit.GitCommit)), target_commitish post_parameters = { "tag_name": tag, "name": name, @@ -800,6 +801,12 @@ class Repository(github.GithubObject.CompletableGithubObject): "draft": draft, "prerelease": prerelease, } + if isinstance(target_commitish, (str, unicode)): + post_parameters["target_commitish"] = target_commitish + elif isinstance(target_commitish, github.Branch.Branch): + post_parameters["target_commitish"] = target_commitish.name + elif isinstance(target_commitish, (github.Commit.Commit, github.GitCommit.GitCommit)): + post_parameters["target_commitish"] = target_commitish.sha headers, data = self._requester.requestJsonAndCheck( "POST", self.url + "/releases", diff --git a/github/tests/GitRelease.py b/github/tests/GitRelease.py index 955c9a57..7576b203 100644 --- a/github/tests/GitRelease.py +++ b/github/tests/GitRelease.py @@ -56,6 +56,8 @@ class Release(Framework.TestCase): 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") + self.assertEqual(self.release.draft, False) + self.assertEqual(self.release.prerelease, False) self.assertEqual(self.release.url, "https://api.github.com/repos/edhollandAL/PyGithub/releases/1210814") self.assertEqual(self.release.author._rawData['login'], "edhollandAL") self.assertEqual(self.release.html_url, "https://github.com/edhollandAL/PyGithub/releases/tag/v1.25.2") diff --git a/github/tests/ReplayData/Repository.testCreateGitRelease.txt b/github/tests/ReplayData/Repository.testCreateGitRelease.txt new file mode 100644 index 00000000..b1320b36 --- /dev/null +++ b/github/tests/ReplayData/Repository.testCreateGitRelease.txt @@ -0,0 +1,11 @@ +https +POST +api.github.com +None +/repos/jacquev6/PyGithub/releases +{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +{"body": "This release is created by PyGithub", "prerelease": false, "tag_name": "vX.Y.Z-by-PyGithub-acctest", "draft": false, "name": "vX.Y.Z: PyGithub acctest"} +201 +[('content-length', '1656'), ('x-runtime-rack', '0.601694'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"64c4aea05900ae1072ee705caf9b529c"'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/releases/7636454'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('status', '201 Created'), ('x-ratelimit-remaining', '4951'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '92E2:1D39A:50FE29C:5DF3D65:59AE9019'), ('date', 'Tue, 05 Sep 2017 11:52:58 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1504614271')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/releases/7636454","assets_url":"https://api.github.com/repos/jacquev6/PyGithub/releases/7636454/assets","upload_url":"https://uploads.github.com/repos/jacquev6/PyGithub/releases/7636454/assets{?name,label}","html_url":"https://github.com/jacquev6/PyGithub/releases/tag/vX.Y.Z-by-PyGithub-acctest","id":7636454,"tag_name":"vX.Y.Z-by-PyGithub-acctest","target_commitish":"master","name":"vX.Y.Z: PyGithub acctest","draft":false,"author":{"login":"jacquev6","id":3760893,"avatar_url":"https://avatars2.githubusercontent.com/u/3760893?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"prerelease":false,"created_at":"2016-10-29T02:39:27Z","published_at":"2017-09-05T11:52:58Z","assets":[],"tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/vX.Y.Z-by-PyGithub-acctest","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/vX.Y.Z-by-PyGithub-acctest","body":"This release is created by PyGithub"} + diff --git a/github/tests/ReplayData/Repository.testCreateGitReleaseWithAllArguments.txt b/github/tests/ReplayData/Repository.testCreateGitReleaseWithAllArguments.txt new file mode 100644 index 00000000..6fd75ef5 --- /dev/null +++ b/github/tests/ReplayData/Repository.testCreateGitReleaseWithAllArguments.txt @@ -0,0 +1,33 @@ +https +POST +api.github.com +None +/repos/jacquev6/PyGithub/releases +{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +{"body": "This release is also created by PyGithub", "name": "vX.Y.Z: PyGithub acctest2", "target_commitish": "da9a285fd8b782461e56cba39ae8d2fa41ca7cdc", "tag_name": "vX.Y.Z-by-PyGithub-acctest2", "prerelease": true, "draft": false} +201 +[('content-length', '1699'), ('x-runtime-rack', '0.625656'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"a640b19b9bc4596ddf16593f4d811ee0"'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/releases/7636488'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('status', '201 Created'), ('x-ratelimit-remaining', '4945'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '958E:1D39A:510378D:5DF9FCA:59AE9091'), ('date', 'Tue, 05 Sep 2017 11:54:58 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1504614271')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/releases/7636488","assets_url":"https://api.github.com/repos/jacquev6/PyGithub/releases/7636488/assets","upload_url":"https://uploads.github.com/repos/jacquev6/PyGithub/releases/7636488/assets{?name,label}","html_url":"https://github.com/jacquev6/PyGithub/releases/tag/vX.Y.Z-by-PyGithub-acctest2","id":7636488,"tag_name":"vX.Y.Z-by-PyGithub-acctest2","target_commitish":"da9a285fd8b782461e56cba39ae8d2fa41ca7cdc","name":"vX.Y.Z: PyGithub acctest2","draft":false,"author":{"login":"jacquev6","id":3760893,"avatar_url":"https://avatars2.githubusercontent.com/u/3760893?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"prerelease":true,"created_at":"2017-09-05T11:35:41Z","published_at":"2017-09-05T11:54:58Z","assets":[],"tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/vX.Y.Z-by-PyGithub-acctest2","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/vX.Y.Z-by-PyGithub-acctest2","body":"This release is also created by PyGithub"} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/tags +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +null +200 +[('content-length', '10153'), ('x-runtime-rack', '0.083151'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"66e56bae266aa8b7261d366dde7aa4e1"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('status', '200 OK'), ('x-ratelimit-remaining', '4944'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '67C6:1D38C:206196:260F56:59AE9092'), ('last-modified', 'Sun, 27 Nov 2016 13:31:42 GMT'), ('link', '; rel="next", ; rel="last"'), ('date', 'Tue, 05 Sep 2017 11:54:59 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1504614271')] +[{"name":"vX.Y.Z-by-PyGithub-acctest2","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/vX.Y.Z-by-PyGithub-acctest2","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/vX.Y.Z-by-PyGithub-acctest2","commit":{"sha":"da9a285fd8b782461e56cba39ae8d2fa41ca7cdc","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/da9a285fd8b782461e56cba39ae8d2fa41ca7cdc"}},{"name":"vX.Y.Z-by-PyGithub-acctest","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/vX.Y.Z-by-PyGithub-acctest","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/vX.Y.Z-by-PyGithub-acctest","commit":{"sha":"a7eb09af049dbcc0d1c71b92abe3b71022b90eb9","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a7eb09af049dbcc0d1c71b92abe3b71022b90eb9"}},{"name":"v2.0.0-alpha.4","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v2.0.0-alpha.4","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v2.0.0-alpha.4","commit":{"sha":"c5a2bb0934ffc04fcd42d0b55e1fec7810bd95b7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/c5a2bb0934ffc04fcd42d0b55e1fec7810bd95b7"}},{"name":"v2.0.0.-alpha.3","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v2.0.0.-alpha.3","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v2.0.0.-alpha.3","commit":{"sha":"d737ccbe2ab54c747374d2a8f1bc9268aa25372d","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/d737ccbe2ab54c747374d2a8f1bc9268aa25372d"}},{"name":"v2.0.0-alpha.2","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v2.0.0-alpha.2","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v2.0.0-alpha.2","commit":{"sha":"4d4c2ed3c79e4fe4e58b0a7b9dbd976cb92b22bb","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/4d4c2ed3c79e4fe4e58b0a7b9dbd976cb92b22bb"}},{"name":"v2.0.0-alpha.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v2.0.0-alpha.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v2.0.0-alpha.1","commit":{"sha":"a27948a3c5ad70f2818379ae07953405fcee9d0d","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a27948a3c5ad70f2818379ae07953405fcee9d0d"}},{"name":"v1.29","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.29","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.29","commit":{"sha":"43f61f9471cc4c1aab69524ba53bb11d6597d0bf","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/43f61f9471cc4c1aab69524ba53bb11d6597d0bf"}},{"name":"v1.28","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.28","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.28","commit":{"sha":"4a657d67f8f325b081233583216db07a88b761c8","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/4a657d67f8f325b081233583216db07a88b761c8"}},{"name":"v1.27.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.27.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.27.1","commit":{"sha":"0098e08792b1aaa2c5cbe498a0139f58199dd90c","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/0098e08792b1aaa2c5cbe498a0139f58199dd90c"}},{"name":"v1.27.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.27.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.27.0","commit":{"sha":"37c9a5045dc592af630f5e46aa53e0c86617d696","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/37c9a5045dc592af630f5e46aa53e0c86617d696"}},{"name":"v1.26.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.26.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.26.0","commit":{"sha":"ace2b0c067a7f92bf12965fb4cbfbc8d893d06d2","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/ace2b0c067a7f92bf12965fb4cbfbc8d893d06d2"}},{"name":"v1.25.2","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.25.2","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.25.2","commit":{"sha":"5a05a5e58f682d315acd2447c87ac5b4d4fc55e8","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/5a05a5e58f682d315acd2447c87ac5b4d4fc55e8"}},{"name":"v1.25.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.25.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.25.1","commit":{"sha":"9962ae226869c8c57aed545a8e4834988682cf31","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/9962ae226869c8c57aed545a8e4834988682cf31"}},{"name":"v1.25.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.25.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.25.0","commit":{"sha":"b64b0d6942bb27095bd035b8c0db10ca35448be3","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/b64b0d6942bb27095bd035b8c0db10ca35448be3"}},{"name":"v1.24.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.24.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.24.1","commit":{"sha":"5e7d45a2f8c09757a0ce6d0bf37a8eec31791578","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/5e7d45a2f8c09757a0ce6d0bf37a8eec31791578"}},{"name":"v1.24.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.24.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.24.0","commit":{"sha":"2e74c7d9ea66484dfbcb64e6c05964c07d1f9c02","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/2e74c7d9ea66484dfbcb64e6c05964c07d1f9c02"}},{"name":"v1.23.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.23.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.23.0","commit":{"sha":"937c7fccf586643530eff6a557f262c1950dc89f","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/937c7fccf586643530eff6a557f262c1950dc89f"}},{"name":"v1.22.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.22.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.22.0","commit":{"sha":"66edeb601fe7fb48d84e9adcc6bdfef64e87a0f0","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/66edeb601fe7fb48d84e9adcc6bdfef64e87a0f0"}},{"name":"v1.21.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.21.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.21.0","commit":{"sha":"3ff7e4843ef251c158dc8d07e667db80e03820bb","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/3ff7e4843ef251c158dc8d07e667db80e03820bb"}},{"name":"v1.20.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.20.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.20.0","commit":{"sha":"8cb3f372837e2648f17e3f085d2821114b507383","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/8cb3f372837e2648f17e3f085d2821114b507383"}},{"name":"v1.19.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.19.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.19.0","commit":{"sha":"9f9be931fb3821256d8bb685577b5167652763d5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/9f9be931fb3821256d8bb685577b5167652763d5"}},{"name":"v1.18.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.18.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.18.0","commit":{"sha":"5a0d5e2b69368ce59fdc8b78688165aceb9f7ca8","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/5a0d5e2b69368ce59fdc8b78688165aceb9f7ca8"}},{"name":"v1.17.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.17.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.17.0","commit":{"sha":"72f8876112ba029111c739871e3e4d7bce66b95d","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/72f8876112ba029111c739871e3e4d7bce66b95d"}},{"name":"v1.16.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.16.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.16.0","commit":{"sha":"539ec2a7258a06af3c5c3e93bfbf4b8d3e4fd672","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/539ec2a7258a06af3c5c3e93bfbf4b8d3e4fd672"}},{"name":"v1.15.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.15.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.15.0","commit":{"sha":"e1c7052ff1ed27c28ea999cb1f9e1ba691eacfc1","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/e1c7052ff1ed27c28ea999cb1f9e1ba691eacfc1"}},{"name":"v1.14.2","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.14.2","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.14.2","commit":{"sha":"446f0c94410e678662bb8770e8dc4d8c263b74e6","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/446f0c94410e678662bb8770e8dc4d8c263b74e6"}},{"name":"v1.14.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.14.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.14.1","commit":{"sha":"2d1c709062ec7bd132a7421429d7bcbf5dca20e4","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/2d1c709062ec7bd132a7421429d7bcbf5dca20e4"}},{"name":"v1.14.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.14.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.14.0","commit":{"sha":"0a0fc8848167c7ad106a0feff93296c006b24fe6","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/0a0fc8848167c7ad106a0feff93296c006b24fe6"}},{"name":"v1.13.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.13.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.13.1","commit":{"sha":"dc96fef052f2b5c6adb34da65169e8df3f35f611","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/dc96fef052f2b5c6adb34da65169e8df3f35f611"}},{"name":"v1.13.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.13.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.13.0","commit":{"sha":"b7e4000450e89b8c6e947e3a1e52fb06da7c9621","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/b7e4000450e89b8c6e947e3a1e52fb06da7c9621"}}] + +https +GET +api.github.com +None +/repositories/70329851/tags?page=2 +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +null +200 +[('content-length', '8154'), ('x-runtime-rack', '0.049311'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"335bb6d8e6561088f4733fa74a8d0022"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('status', '200 OK'), ('x-ratelimit-remaining', '4943'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '8F47:1D39A:5103938:5DFA1D9:59AE9093'), ('last-modified', 'Sun, 27 Nov 2016 13:31:42 GMT'), ('link', '; rel="first", ; rel="prev"'), ('date', 'Tue, 05 Sep 2017 11:55:00 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1504614271')] +[{"name":"v1.12.2","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.12.2","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.12.2","commit":{"sha":"03a256a4052cacea998d8205a83d5b5465f31e18","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/03a256a4052cacea998d8205a83d5b5465f31e18"}},{"name":"v1.12.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.12.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.12.1","commit":{"sha":"67bdf8c0be32dc195a4545bf90100a1b55eebf45","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/67bdf8c0be32dc195a4545bf90100a1b55eebf45"}},{"name":"v1.12.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.12.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.12.0","commit":{"sha":"c8553031178cbf221d95af1ecc7ffd4707ac5cc9","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/c8553031178cbf221d95af1ecc7ffd4707ac5cc9"}},{"name":"v1.11.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.11.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.11.1","commit":{"sha":"392a422ec2b9b97f7b1ad41e04cc62ef67ad0e7f","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/392a422ec2b9b97f7b1ad41e04cc62ef67ad0e7f"}},{"name":"v1.11.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.11.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.11.0","commit":{"sha":"6b32e1cdf588d8c3c651d355ffc3451dd34284b9","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/6b32e1cdf588d8c3c651d355ffc3451dd34284b9"}},{"name":"v1.10.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.10.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.10.0","commit":{"sha":"4400a24872e52ee488067a7d0d8522ca3764b4e5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/4400a24872e52ee488067a7d0d8522ca3764b4e5"}},{"name":"v1.9.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.9.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.9.1","commit":{"sha":"a922319db0037babe9919a83b8b69efebcf942ea","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a922319db0037babe9919a83b8b69efebcf942ea"}},{"name":"v1.9.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.9.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.9.0","commit":{"sha":"808fe92191d287bbad6131c5a8be78b4ded745fd","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/808fe92191d287bbad6131c5a8be78b4ded745fd"}},{"name":"v1.8.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.8.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.8.1","commit":{"sha":"e3d76fc3ec3dd4f4c3b3a440ff9e771f06d63a39","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/e3d76fc3ec3dd4f4c3b3a440ff9e771f06d63a39"}},{"name":"v1.8.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.8.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.8.0","commit":{"sha":"31110327ec45f3138e58ed247b2cf420fee481ec","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/31110327ec45f3138e58ed247b2cf420fee481ec"}},{"name":"v1.7","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.7","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.7","commit":{"sha":"df3290644ad7846d4ca93ba94af943ae1431ee1c","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/df3290644ad7846d4ca93ba94af943ae1431ee1c"}},{"name":"v1.6","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.6","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.6","commit":{"sha":"cabc55dc3b858b7e02076e2c1041f242f05b9f1c","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/cabc55dc3b858b7e02076e2c1041f242f05b9f1c"}},{"name":"v1.5","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.5","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.5","commit":{"sha":"ece857f70e19b69ebeda244da71f892c8b05f53a","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/ece857f70e19b69ebeda244da71f892c8b05f53a"}},{"name":"v1.4","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.4","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.4","commit":{"sha":"bf1e3b588b2a91afcabb64d5d28476bdbf074912","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/bf1e3b588b2a91afcabb64d5d28476bdbf074912"}},{"name":"v1.3","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.3","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.3","commit":{"sha":"e6c64ab31ea88229f0c81ae9f83496db34452db7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/e6c64ab31ea88229f0c81ae9f83496db34452db7"}},{"name":"v1.2","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.2","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.2","commit":{"sha":"d40bec470e30bac4175d62a880b42757939553c9","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/d40bec470e30bac4175d62a880b42757939553c9"}},{"name":"v1.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.1","commit":{"sha":"6658713d2790d1d47886ed9cee84ba645f160877","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/6658713d2790d1d47886ed9cee84ba645f160877"}},{"name":"v1.0","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v1.0","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v1.0","commit":{"sha":"0855be0a4db8537b313b370b2a4642b7971a8296","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/0855be0a4db8537b313b370b2a4642b7971a8296"}},{"name":"v0.7","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v0.7","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v0.7","commit":{"sha":"ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7"}},{"name":"v0.6","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v0.6","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v0.6","commit":{"sha":"4303c5b90e2216d927155e9609436ccb8984c495","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/4303c5b90e2216d927155e9609436ccb8984c495"}},{"name":"v0.5","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v0.5","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v0.5","commit":{"sha":"936f4a97f1a86392637ec002bbf89ff036a5062d","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/936f4a97f1a86392637ec002bbf89ff036a5062d"}},{"name":"v0.4","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v0.4","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v0.4","commit":{"sha":"a3be28756101370fbc689eec3a7825c4c385a6c9","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a3be28756101370fbc689eec3a7825c4c385a6c9"}},{"name":"v0.3","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v0.3","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v0.3","commit":{"sha":"636e6112deb72277b3bffcc3303cd7e8a7431a5d","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/636e6112deb72277b3bffcc3303cd7e8a7431a5d"}},{"name":"v0.2","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v0.2","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v0.2","commit":{"sha":"9f0b05161f9d1962b9156e6c91fc04f382028240","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/9f0b05161f9d1962b9156e6c91fc04f382028240"}},{"name":"v0.1","zipball_url":"https://api.github.com/repos/jacquev6/PyGithub/zipball/v0.1","tarball_url":"https://api.github.com/repos/jacquev6/PyGithub/tarball/v0.1","commit":{"sha":"dbdcda3591980de42617814f792969126e6402c3","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/dbdcda3591980de42617814f792969126e6402c3"}}] + diff --git a/github/tests/Repository.py b/github/tests/Repository.py index 1affd1a0..1cbc57df 100644 --- a/github/tests/Repository.py +++ b/github/tests/Repository.py @@ -290,6 +290,35 @@ class Repository(Framework.TestCase): commit = self.repo.create_git_commit("Commit created by PyGithub", tree, [], github.InputGitAuthor("John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00"), github.InputGitAuthor("John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00")) self.assertEqual(commit.sha, "526946197ae9da59c6507cacd13ad6f1cfb686ea") + def testCreateGitRelease(self): + release = self.repo.create_git_release( + "vX.Y.Z-by-PyGithub-acctest", + "vX.Y.Z: PyGithub acctest", + "This release is created by PyGithub", + ) + self.assertEqual(release.tag_name, "vX.Y.Z-by-PyGithub-acctest") + self.assertEqual(release.title, "vX.Y.Z: PyGithub acctest") + self.assertEqual(release.body, "This release is created by PyGithub") + self.assertEqual(release.draft, False) + self.assertEqual(release.prerelease, False) + + def testCreateGitReleaseWithAllArguments(self): + release = self.repo.create_git_release( + "vX.Y.Z-by-PyGithub-acctest2", + "vX.Y.Z: PyGithub acctest2", + "This release is also created by PyGithub", + False, + True, + "da9a285fd8b782461e56cba39ae8d2fa41ca7cdc", + ) + self.assertEqual(release.tag_name, "vX.Y.Z-by-PyGithub-acctest2") + self.assertEqual(release.title, "vX.Y.Z: PyGithub acctest2") + self.assertEqual(release.body, "This release is also created by PyGithub") + self.assertEqual(release.draft, False) + self.assertEqual(release.prerelease, True) + tag = [tag for tag in self.repo.get_tags() if tag.name == "vX.Y.Z-by-PyGithub-acctest2"].pop() + self.assertEqual(tag.commit.sha, "da9a285fd8b782461e56cba39ae8d2fa41ca7cdc") + def testCreateGitTag(self): tag = self.repo.create_git_tag("TaggedByPyGithub", "Tag created by PyGithub", "0b820628236ab8bab3890860fc414fa757ca15f4", "commit") self.assertEqual(tag.sha, "5ba561eaa2b7ca9015662510157b15d8f3b0232a")