Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add html_url property in Team Class. #1983

Merged
merged 1 commit into from Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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