kopia lustrzana https://github.com/Langenfeld/py-gitea
fixed listing user accessible repositories
rodzic
2645ff5c07
commit
5d1ed27c88
|
@ -170,6 +170,11 @@ class User(GiteaApiObject):
|
||||||
results = self.gitea.requests_get(url, sudo=self)
|
results = self.gitea.requests_get(url, sudo=self)
|
||||||
return [Team.parse_response(self.gitea, result) for result in results]
|
return [Team.parse_response(self.gitea, result) for result in results]
|
||||||
|
|
||||||
|
def get_accessible_repos(self) -> List['Repository']:
|
||||||
|
""" Get all Repositories accessible by the logged in User."""
|
||||||
|
results = self.gitea.requests_get("/user/repos", sudo=self)
|
||||||
|
return [Repository.parse_response(self, result) for result in results]
|
||||||
|
|
||||||
def __request_emails(self):
|
def __request_emails(self):
|
||||||
result = self.gitea.requests_get(User.USER_MAIL % self.login)
|
result = self.gitea.requests_get(User.USER_MAIL % self.login)
|
||||||
# report if the adress changed by this
|
# report if the adress changed by this
|
||||||
|
@ -808,11 +813,6 @@ class Gitea:
|
||||||
path = "/repos/" + username + "/" + reponame + "/subscription"
|
path = "/repos/" + username + "/" + reponame + "/subscription"
|
||||||
return self.requests_get(path)
|
return self.requests_get(path)
|
||||||
|
|
||||||
def get_accessible_repositories(self) -> List['Repository']:
|
|
||||||
""" Get all Repositories accessible by the logged in User."""
|
|
||||||
results = self.requests_get("/user/repos")
|
|
||||||
return [Repository.parse_response(self, result) for result in results]
|
|
||||||
|
|
||||||
def get_users_following(self, username):
|
def get_users_following(self, username):
|
||||||
path = "/users/" + username + "/following"
|
path = "/users/" + username + "/following"
|
||||||
return self.requests_get(path)
|
return self.requests_get(path)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -5,7 +5,7 @@ with open('README.md') as readme_file:
|
||||||
|
|
||||||
setup_args = dict(
|
setup_args = dict(
|
||||||
name='py-gitea',
|
name='py-gitea',
|
||||||
version='0.1.4',
|
version='0.1.5',
|
||||||
description='A python wrapper for the Gitea API',
|
description='A python wrapper for the Gitea API',
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
long_description=README,
|
long_description=README,
|
||||||
|
|
|
@ -155,6 +155,11 @@ def test_user_teams(instance):
|
||||||
teams = user.get_teams()
|
teams = user.get_teams()
|
||||||
assert team in teams
|
assert team in teams
|
||||||
|
|
||||||
|
def test_get_accessible_repositories(instance):
|
||||||
|
user = instance.get_user_by_name(test_user)
|
||||||
|
repos = user.get_accessible_repos()
|
||||||
|
assert len(repos) > 0
|
||||||
|
|
||||||
def test_create_issue(instance):
|
def test_create_issue(instance):
|
||||||
org = Organization.request(instance, test_org)
|
org = Organization.request(instance, test_org)
|
||||||
repo = Repository.request(instance, org.username, test_repo)
|
repo = Repository.request(instance, org.username, test_repo)
|
||||||
|
@ -202,13 +207,10 @@ def test_delete_org(instance):
|
||||||
Organization.request(instance, test_org)
|
Organization.request(instance, test_org)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_delete_user(instance):
|
def test_delete_user(instance):
|
||||||
user = User.request(instance, test_user)
|
user = User.request(instance, test_user)
|
||||||
user.delete()
|
user.delete()
|
||||||
with pytest.raises(NotFoundException) as e:
|
with pytest.raises(NotFoundException) as e:
|
||||||
User.request(instance, test_user)
|
User.request(instance, test_user)
|
||||||
|
|
||||||
|
|
||||||
def test_get_accessible_repositories(instance):
|
|
||||||
repos = instance.get_accessible_repositories()
|
|
||||||
assert repos == []
|
|
||||||
|
|
Ładowanie…
Reference in New Issue