Skip to content

Commit

Permalink
Feat: Add html_url property in Team Class. (#1983)
Browse files Browse the repository at this point in the history
Fixes: #1942
  • Loading branch information
Hanaasagi committed Oct 13, 2021
1 parent aa694f8 commit 6570892
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions github/Team.py
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"])
2 changes: 2 additions & 0 deletions github/Team.pyi
Expand Up @@ -64,3 +64,5 @@ class Team(CompletableGithubObject):
def slug(self) -> str: ...
@property
def url(self) -> str: ...
@property
def html_url(self) -> str: ...
2 changes: 1 addition & 1 deletion tests/ReplayData/Team.setUp.txt
Expand Up @@ -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"}

3 changes: 3 additions & 0 deletions tests/Team.py
Expand Up @@ -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())
Expand Down

0 comments on commit 6570892

Please sign in to comment.