From f05156174e54245a2b076393a8b6a58ff60301b0 Mon Sep 17 00:00:00 2001 From: Hanaasagi Date: Tue, 29 Jun 2021 12:36:11 +0000 Subject: [PATCH] Feat: Add `html_url` property in Team Class. Fixes: #1942 --- github/Team.py | 11 +++++++++++ github/Team.pyi | 2 ++ tests/ReplayData/Team.setUp.txt | 2 +- tests/Team.py | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/github/Team.py b/github/Team.py index d69073fb8a..1d1b2a39a3 100644 --- a/github/Team.py +++ b/github/Team.py @@ -164,6 +164,14 @@ def parent(self): self._completeIfNotSet(self._parent) return self._parent.value + @property + def html_url(self): + """ + :type: string + """ + self._completeIfNotSet(self._html_url) + return self._html_url.value + def add_to_members(self, member): """ This API call is deprecated. Use `add_membership` instead. @@ -486,6 +494,7 @@ def _initAttributes(self): self._organization = github.GithubObject.NotSet self._privacy = github.GithubObject.NotSet self._parent = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "id" in attributes: # pragma no branch @@ -520,3 +529,5 @@ def _useAttributes(self, attributes): self._parent = self._makeClassAttribute( github.Team.Team, attributes["parent"] ) + if "html_url" in attributes: + self._html_url = self._makeStringAttribute(attributes["html_url"]) diff --git a/github/Team.pyi b/github/Team.pyi index 4b9bb446a8..2dafb9728b 100644 --- a/github/Team.pyi +++ b/github/Team.pyi @@ -64,3 +64,5 @@ class Team(CompletableGithubObject): def slug(self) -> str: ... @property def url(self) -> str: ... + @property + def html_url(self) -> str: ... diff --git a/tests/ReplayData/Team.setUp.txt b/tests/ReplayData/Team.setUp.txt index 1fd16b1618..0298a97c50 100644 --- a/tests/ReplayData/Team.setUp.txt +++ b/tests/ReplayData/Team.setUp.txt @@ -18,5 +18,5 @@ None None 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4975'), ('content-length', '145'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"03555a65309084f36bcf959063a39d35"'), ('date', 'Sat, 26 May 2012 21:09:52 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"repos_count":0,"url":"https://api.github.com/teams/189850","members_count":0,"name":"Team created by PyGithub","slug": "pygithub","privacy":"closed","permission":"pull","id":189850,"organization":{"login":"BeaverSoftware","id":1424031,"url":"https://api.github.com/orgs/BeaverSoftware"}} +{"repos_count":0,"url":"https://api.github.com/teams/189850","members_count":0,"name":"Team created by PyGithub","slug": "pygithub","privacy":"closed","permission":"pull","id":189850,"organization":{"login":"BeaverSoftware","id":1424031,"url":"https://api.github.com/orgs/BeaverSoftware"},"html_url":"https://github.com/orgs/BeaverSoftware/teams/core"} diff --git a/tests/Team.py b/tests/Team.py index c2d9d46bff..8812a84371 100644 --- a/tests/Team.py +++ b/tests/Team.py @@ -58,6 +58,9 @@ def testAttributes(self): self.assertEqual( repr(self.team), 'Team(name="Team created by PyGithub", id=189850)' ) + self.assertEqual( + self.team.html_url, "https://github.com/orgs/BeaverSoftware/teams/core" + ) def testDiscussions(self): discussions = list(self.team.get_discussions())