mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Adds get_issue_events to PullRequest object (#1154)
* Adds `get_issue_events` to `PullRequest` object * Add unit test for * Fix PullRequest.get_issue_events unit test Use actual event ids... * Fix missing import on PullRequest. I wish the unit tests would run in Python3... * Add PulReqeust.testGetIssueEvents ReplayData * Updating replay data to use developer's personal credentials.
This commit is contained in:
committed by
Wan Liuyang
parent
828b53b756
commit
acd515aaec
@@ -56,6 +56,8 @@ import github.IssueComment
|
||||
import github.Commit
|
||||
import github.PullRequestReview
|
||||
|
||||
import Consts
|
||||
|
||||
|
||||
class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
@@ -627,6 +629,19 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def get_issue_events(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/issues/:issue_number/events <http://developer.github.com/v3/issues/events>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueEvent.IssueEvent`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.IssueEvent.IssueEvent,
|
||||
self._requester,
|
||||
self.issue_url + "/events",
|
||||
None,
|
||||
headers={'Accept': Consts.mediaTypeLockReasonPreview}
|
||||
)
|
||||
|
||||
def get_review(self, id):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/pulls/:number/reviews/:id <https://developer.github.com/v3/pulls/reviews>`_
|
||||
|
||||
@@ -131,6 +131,9 @@ class PullRequest(Framework.TestCase):
|
||||
comment = self.pull.get_issue_comment(8387331)
|
||||
self.assertEqual(comment.body, "Issue comment created by PyGithub")
|
||||
|
||||
def testGetIssueEvents(self):
|
||||
self.assertListKeyEqual(self.pull.get_issue_events(), lambda e: e.id, [16349963, 16350729, 16350730, 16350731, 28469043, 98136335])
|
||||
|
||||
def testGetReviewComments(self):
|
||||
epoch = datetime.datetime(1970, 1, 1, 0, 0)
|
||||
comments = self.pull.get_review_comments(since=epoch)
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user