mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 11:21:16 +00:00
Add 'submitted at' to PullRequestReview (#565)
This field is not currently listed in the Github documentation at https://developer.github.com/v3/pulls/reviews/, but it's been included since Github 2.9 (It even exists in the test data returned for the original PullRequestReview PR)
This commit is contained in:
@@ -95,6 +95,14 @@ class PullRequestReview(github.GithubObject.CompletableGithubObject):
|
||||
self._completeIfNotSet(self._pull_request_url)
|
||||
return self._pull_request_url.value
|
||||
|
||||
@property
|
||||
def submitted_at(self):
|
||||
"""
|
||||
:type: datetime.datetime
|
||||
"""
|
||||
self._completeIfNotSet(self._submitted_at)
|
||||
return self._submitted_at.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
@@ -103,6 +111,7 @@ class PullRequestReview(github.GithubObject.CompletableGithubObject):
|
||||
self._state = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._pull_request_url = github.GithubObject.NotSet
|
||||
self._submitted_at = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "id" in attributes: # pragma no branch
|
||||
@@ -119,3 +128,5 @@ class PullRequestReview(github.GithubObject.CompletableGithubObject):
|
||||
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
||||
if "pull_request_url" in attributes: # pragma no branch
|
||||
self._pull_request_url = self._makeStringAttribute(attributes["pull_request_url"])
|
||||
if "submitted_at" in attributes: # pragma no branch
|
||||
self._submitted_at = self._makeDatetimeAttribute(attributes["submitted_at"])
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
import Framework
|
||||
|
||||
import datetime
|
||||
|
||||
class PullRequestReview(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
@@ -46,6 +48,7 @@ class PullRequestReview(Framework.TestCase):
|
||||
self.assertEqual(self.pullreview.state, "APPROVED")
|
||||
self.assertEqual(self.pullreview.html_url, "https://github.com/PyGithub/PyGithub/pull/538#pullrequestreview-28482091")
|
||||
self.assertEqual(self.pullreview.pull_request_url, "https://api.github.com/repos/PyGithub/PyGithub/pulls/538")
|
||||
self.assertEqual(self.pullreview.submitted_at, datetime.datetime(2017, 3, 22, 19, 6, 59))
|
||||
|
||||
# test __repr__() based on this attributes
|
||||
self.assertEqual(self.pullreview.__repr__(), 'PullRequestReview(user=NamedUser(login="jzelinskie"), id=28482091)')
|
||||
|
||||
Reference in New Issue
Block a user