Collaborator site admin (#719)

* Add admin_user property to NamedUser

* Fix type from string to bool for site_admin property

* Add a test for site_admin
This commit is contained in:
Victor Granic
2018-03-06 10:35:11 +08:00
committed by Wan Liuyang
parent 6109eb3c2b
commit f8b23505da
2 changed files with 12 additions and 0 deletions
+11
View File
@@ -300,6 +300,14 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._repos_url)
return self._repos_url.value
@property
def site_admin(self):
"""
:type: bool
"""
self._completeIfNotSet(self._site_admin)
return self._site_admin.value
@property
def starred_url(self):
"""
@@ -580,6 +588,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
self._public_repos = github.GithubObject.NotSet
self._received_events_url = github.GithubObject.NotSet
self._repos_url = github.GithubObject.NotSet
self._site_admin = github.GithubObject.NotSet
self._starred_url = github.GithubObject.NotSet
self._subscriptions_url = github.GithubObject.NotSet
self._total_private_repos = github.GithubObject.NotSet
@@ -650,6 +659,8 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
self._received_events_url = self._makeStringAttribute(attributes["received_events_url"])
if "repos_url" in attributes: # pragma no branch
self._repos_url = self._makeStringAttribute(attributes["repos_url"])
if "site_admin" in attributes: # pragma no branch
self._site_admin = self._makeBoolAttribute(attributes["site_admin"])
if "starred_url" in attributes: # pragma no branch
self._starred_url = self._makeStringAttribute(attributes["starred_url"])
if "subscriptions_url" in attributes: # pragma no branch
+1
View File
@@ -313,6 +313,7 @@ class Repository(Framework.TestCase):
self.assertTrue(jacquev6.permissions.admin, True)
self.assertTrue(jacquev6.permissions.pull, True)
self.assertTrue(jacquev6.permissions.push, True)
self.assertFalse(jacquev6.site_admin)
self.repo.remove_from_collaborators(lyloa)
self.assertFalse(self.repo.has_in_collaborators(lyloa))