Jump from notifications to related PRs/issues. (#1168)

* Jump from notifications to related PRs/issues.

* Add test case for jumping to related PRs/issues.

Also another method to get notifications scoped to a repository,
otherwise it's hard to keep out sensitive information from the test
cases.
This commit is contained in:
Olof-Joachim Frahm (欧雅福)
2019-09-22 18:59:21 +10:00
committed by Steve Kowalik
parent b84d9b1928
commit 020fbebcaf
7 changed files with 146 additions and 0 deletions
+14
View File
@@ -125,6 +125,20 @@ class Notification(github.GithubObject.CompletableGithubObject):
self.url,
)
def get_pull_request(self):
headers, data = self._requester.requestJsonAndCheck(
"GET",
self.subject.url
)
return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
def get_issue(self):
headers, data = self._requester.requestJsonAndCheck(
"GET",
self.subject.url
)
return github.Issue.Issue(self._requester, headers, data, completed=True)
def _initAttributes(self):
self._id = github.GithubObject.NotSet
self._last_read_at = github.GithubObject.NotSet