mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Patch issue 358 status context (#428)
* Add "context" to CommitStatus * Add testcase for context in CommitStatus
This commit is contained in:
committed by
Jimmy Zelinskie
parent
3c6f99feb4
commit
70e30c5371
@@ -70,6 +70,13 @@ class CommitStatus(github.GithubObject.NonCompletableGithubObject):
|
||||
"""
|
||||
return self._state.value
|
||||
|
||||
@property
|
||||
def context(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
return self._context.value
|
||||
|
||||
@property
|
||||
def target_url(self):
|
||||
"""
|
||||
@@ -97,6 +104,7 @@ class CommitStatus(github.GithubObject.NonCompletableGithubObject):
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._state = github.GithubObject.NotSet
|
||||
self._context = github.GithubObject.NotSet
|
||||
self._target_url = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
@@ -112,6 +120,8 @@ class CommitStatus(github.GithubObject.NonCompletableGithubObject):
|
||||
self._id = self._makeIntAttribute(attributes["id"])
|
||||
if "state" in attributes: # pragma no branch
|
||||
self._state = self._makeStringAttribute(attributes["state"])
|
||||
if "context" in attributes: # pragma no branch
|
||||
self._context = self._makeStringAttribute(attributes["context"])
|
||||
if "target_url" in attributes: # pragma no branch
|
||||
self._target_url = self._makeStringAttribute(attributes["target_url"])
|
||||
if "updated_at" in attributes: # pragma no branch
|
||||
|
||||
@@ -44,5 +44,6 @@ class CommitStatus(Framework.TestCase):
|
||||
self.assertEqual(self.statuses[0].id, 277040)
|
||||
self.assertEqual(self.statuses[0].state, "success")
|
||||
self.assertEqual(self.statuses[1].state, "pending")
|
||||
self.assertEqual(self.statuses[0].context, "build")
|
||||
self.assertEqual(self.statuses[0].target_url, "https://github.com/jacquev6/PyGithub/issues/67")
|
||||
self.assertEqual(self.statuses[1].target_url, None)
|
||||
|
||||
@@ -40,5 +40,5 @@ None
|
||||
null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4967'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"33102158c69b28937a0b6a7031ba9c88"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 08 Sep 2012 11:33:19 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[{"description":"Status successfuly created by PyGithub","created_at":"2012-09-08T11:30:56Z","target_url":"https://github.com/jacquev6/PyGithub/issues/67","state":"success","updated_at":"2012-09-08T11:30:56Z","url":"https://api.github.com/repos/jacquev6/PyGithub/statuses/277040","id":277040,"creator":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","url":"https://api.github.com/users/jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"}},{"description":null,"created_at":"2012-09-08T11:27:12Z","target_url":null,"state":"pending","updated_at":"2012-09-08T11:27:12Z","url":"https://api.github.com/repos/jacquev6/PyGithub/statuses/277031","id":277031,"creator":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","url":"https://api.github.com/users/jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"}}]
|
||||
[{"description":"Status successfuly created by PyGithub","created_at":"2012-09-08T11:30:56Z","target_url":"https://github.com/jacquev6/PyGithub/issues/67","state":"success","context":"build","updated_at":"2012-09-08T11:30:56Z","url":"https://api.github.com/repos/jacquev6/PyGithub/statuses/277040","id":277040,"creator":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","url":"https://api.github.com/users/jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"}},{"description":null,"created_at":"2012-09-08T11:27:12Z","target_url":null,"state":"pending","updated_at":"2012-09-08T11:27:12Z","url":"https://api.github.com/repos/jacquev6/PyGithub/statuses/277031","id":277031,"creator":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","url":"https://api.github.com/users/jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"}}]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user