mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Merge branch 'topic/PullRequest.assignee' into develop
This commit is contained in:
@@ -1014,6 +1014,7 @@ Class `PullRequest`
|
||||
Attributes
|
||||
----------
|
||||
* `additions`: integer
|
||||
* `assignee`: `NamedUser`
|
||||
* `base`: `PullRequestPart`
|
||||
* `body`: string
|
||||
* `changed_files`: integer
|
||||
|
||||
@@ -31,6 +31,11 @@ class PullRequest(GithubObject.GithubObject):
|
||||
self._completeIfNotSet(self._additions)
|
||||
return self._NoneIfNotSet(self._additions)
|
||||
|
||||
@property
|
||||
def assignee(self):
|
||||
self._completeIfNotSet(self._assignee)
|
||||
return self._NoneIfNotSet(self._assignee)
|
||||
|
||||
@property
|
||||
def base(self):
|
||||
self._completeIfNotSet(self._base)
|
||||
@@ -292,6 +297,7 @@ class PullRequest(GithubObject.GithubObject):
|
||||
|
||||
def _initAttributes(self):
|
||||
self._additions = GithubObject.NotSet
|
||||
self._assignee = GithubObject.NotSet
|
||||
self._base = GithubObject.NotSet
|
||||
self._body = GithubObject.NotSet
|
||||
self._changed_files = GithubObject.NotSet
|
||||
@@ -322,6 +328,9 @@ class PullRequest(GithubObject.GithubObject):
|
||||
if "additions" in attributes: # pragma no branch
|
||||
assert attributes["additions"] is None or isinstance(attributes["additions"], int), attributes["additions"]
|
||||
self._additions = attributes["additions"]
|
||||
if "assignee" in attributes: # pragma no branch
|
||||
assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"]
|
||||
self._assignee = None if attributes["assignee"] is None else NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False)
|
||||
if "base" in attributes: # pragma no branch
|
||||
assert attributes["base"] is None or isinstance(attributes["base"], dict), attributes["base"]
|
||||
self._base = None if attributes["base"] is None else PullRequestPart.PullRequestPart(self._requester, attributes["base"], completed=False)
|
||||
|
||||
@@ -26,6 +26,7 @@ class PullRequest(Framework.TestCase):
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEqual(self.pull.additions, 511)
|
||||
self.assertEqual(self.pull.assignee.login, "jacquev6")
|
||||
self.assertEqual(self.pull.base.label, "jacquev6:topic/RewriteWithGeneratedCode")
|
||||
self.assertEqual(self.pull.base.sha, "ed866fc43833802ab553e5ff8581c81bb00dd433")
|
||||
self.assertEqual(self.pull.base.user.login, "jacquev6")
|
||||
@@ -34,7 +35,7 @@ class PullRequest(Framework.TestCase):
|
||||
self.assertEqual(self.pull.body, "Body edited by PyGithub")
|
||||
self.assertEqual(self.pull.changed_files, 45)
|
||||
self.assertEqual(self.pull.closed_at, datetime.datetime(2012, 5, 27, 10, 29, 7))
|
||||
self.assertEqual(self.pull.comments, 0)
|
||||
self.assertEqual(self.pull.comments, 1)
|
||||
self.assertEqual(self.pull.commits, 3)
|
||||
self.assertEqual(self.pull.created_at, datetime.datetime(2012, 5, 27, 9, 25, 36))
|
||||
self.assertEqual(self.pull.deletions, 384)
|
||||
@@ -43,7 +44,7 @@ class PullRequest(Framework.TestCase):
|
||||
self.assertEqual(self.pull.html_url, "https://github.com/jacquev6/PyGithub/pull/31")
|
||||
self.assertEqual(self.pull.id, 1436215)
|
||||
self.assertEqual(self.pull.issue_url, "https://github.com/jacquev6/PyGithub/issues/31")
|
||||
self.assertEqual(self.pull.mergeable, None)
|
||||
self.assertEqual(self.pull.mergeable, False)
|
||||
self.assertEqual(self.pull.merged, True)
|
||||
self.assertEqual(self.pull.merged_at, datetime.datetime(2012, 5, 27, 10, 29, 7))
|
||||
self.assertEqual(self.pull.merged_by.login, "jacquev6")
|
||||
@@ -52,7 +53,7 @@ class PullRequest(Framework.TestCase):
|
||||
self.assertEqual(self.pull.review_comments, 1)
|
||||
self.assertEqual(self.pull.state, "closed")
|
||||
self.assertEqual(self.pull.title, "Title edited by PyGithub")
|
||||
self.assertEqual(self.pull.updated_at, datetime.datetime(2012, 5, 27, 10, 29, 7))
|
||||
self.assertEqual(self.pull.updated_at, datetime.datetime(2012, 11, 3, 8, 19, 40))
|
||||
self.assertEqual(self.pull.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/31")
|
||||
self.assertEqual(self.pull.user.login, "jacquev6")
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@ https GET api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic
|
||||
|
||||
https GET api.github.com None /repos/jacquev6/PyGithub/pulls/31 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4948'), ('content-length', '4806'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2ec526e3dd610dfb92cccc8159bd2585"'), ('date', 'Sun, 27 May 2012 10:32:06 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"merged":true,"mergeable":null,"_links":{"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"},"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31/comments"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31"},"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31/comments"}},"head":{"ref":"master","label":"BeaverSoftware:master","repo":{"clone_url":"https://github.com/BeaverSoftware/PyGithub.git","has_downloads":true,"watchers":1,"updated_at":"2012-05-27T09:09:17Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/BeaverSoftware/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":false,"fork":true,"forks":0,"git_url":"git://github.com/BeaverSoftware/PyGithub.git","size":176,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/PyGithub","owner":{"url":"https://api.github.com/users/BeaverSoftware","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:BeaverSoftware/PyGithub.git","pushed_at":"2012-05-27T09:09:17Z","created_at":"2012-05-27T08:50:04Z","id":4460787,"html_url":"https://github.com/BeaverSoftware/PyGithub","full_name":"BeaverSoftware/PyGithub"},"user":{"url":"https://api.github.com/users/BeaverSoftware","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031},"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},"updated_at":"2012-05-27T10:29:07Z","issue_url":"https://github.com/jacquev6/PyGithub/issues/31","changed_files":45,"body":"Body edited by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31","comments":0,"base":{"ref":"topic/RewriteWithGeneratedCode","label":"jacquev6:topic/RewriteWithGeneratedCode","repo":{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":15,"updated_at":"2012-05-27T10:29:10Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":3,"git_url":"git://github.com/jacquev6/PyGithub.git","size":188,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-27T10:29:09Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"sha":"ed866fc43833802ab553e5ff8581c81bb00dd433"},"number":31,"diff_url":"https://github.com/jacquev6/PyGithub/pull/31.diff","merged_by":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"closed_at":"2012-05-27T10:29:07Z","title":"Title edited by PyGithub","deletions":384,"merged_at":"2012-05-27T10:29:07Z","patch_url":"https://github.com/jacquev6/PyGithub/pull/31.patch","additions":511,"created_at":"2012-05-27T09:25:36Z","user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"state":"closed","id":1436215,"review_comments":1,"commits":3,"html_url":"https://github.com/jacquev6/PyGithub/pull/31"}
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '4182'), ('server', 'nginx'), ('last-modified', 'Sat, 03 Nov 2012 08:19:40 GMT'), ('connection', 'keep-alive'), ('etag', '"1ec7d9f2ebb27db7dc002f1382d23975"'), ('cache-control', 'private, s-maxage=60, max-age=60'), ('date', 'Sat, 03 Nov 2012 08:19:46 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"additions":511,"deletions":384,"merged_at":"2012-05-27T10:29:07Z","base":{"label":"jacquev6:topic/RewriteWithGeneratedCode","repo":{"watchers":97,"pushed_at":"2012-11-03T08:07:38Z","watchers_count":97,"forks":27,"open_issues":12,"mirror_url":null,"description":"Python library implementing the full Github API v3","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"open_issues_count":12,"url":"https://api.github.com/repos/jacquev6/PyGithub","updated_at":"2012-11-03T08:07:40Z","html_url":"https://github.com/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","language":"Python","has_downloads":true,"ssh_url":"git@github.com:jacquev6/PyGithub.git","size":256,"forks_count":27,"fork":false,"full_name":"jacquev6/PyGithub","name":"PyGithub","created_at":"2012-02-25T12:53:47Z","git_url":"git://github.com/jacquev6/PyGithub.git","svn_url":"https://github.com/jacquev6/PyGithub","homepage":"http://vincent-jacques.net/PyGithub","has_wiki":true,"private":false,"id":3544490,"has_issues":true},"sha":"ed866fc43833802ab553e5ff8581c81bb00dd433","ref":"topic/RewriteWithGeneratedCode","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146}},"review_comments":1,"changed_files":45,"merge_commit_sha":"28ae6dd10ebccd5eaf8db8dacb5b699ee7f4a663","closed_at":"2012-05-27T10:29:07Z","number":31,"issue_url":"https://github.com/jacquev6/PyGithub/issues/31","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31","milestone":null,"updated_at":"2012-11-03T08:19:40Z","patch_url":"https://github.com/jacquev6/PyGithub/pull/31.patch","html_url":"https://github.com/jacquev6/PyGithub/pull/31","merged_by":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"commits":3,"state":"closed","mergeable":false,"_links":{"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31/comments"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31"},"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31"},"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31/comments"}},"head":{"label":"BeaverSoftware:master","repo":null,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","ref":"master","user":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png","login":"BeaverSoftware","id":1424031}},"assignee":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"diff_url":"https://github.com/jacquev6/PyGithub/pull/31.diff","comments":1,"created_at":"2012-05-27T09:25:36Z","id":1436215,"merged":true,"mergeable_state":"dirty","body":"Body edited by PyGithub","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"title":"Title edited by PyGithub"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user