Merge pull request #5 from holgi/master

Fixed to small bugs
pull/7/head
Langenfeld 2021-05-06 16:13:07 +02:00 zatwierdzone przez GitHub
commit 3816745354
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 13 dodań i 5 usunięć

3
.gitignore vendored
Wyświetl plik

@ -1,3 +1,6 @@
*.pyc
.*.sw*
*.token
# local virtual environment
.venv

Wyświetl plik

@ -464,8 +464,8 @@ class Issue(GiteaApiObject):
GET_COMMENTS = """/repos/%s/%s/issues/comments"""
CREATE_ISSUE = """/repos/{owner}/{repo}/issues"""
OPENED = "closed"
CLOSED = "open"
OPENED = "open"
CLOSED = "closed"
def __init__(self, gitea, id: int):
super(Issue, self).__init__(gitea, id=id)
@ -801,8 +801,8 @@ class Gitea:
def get_accessible_repositories(self) -> List[GiteaApiObject]:
""" Get all Repositories accessible by the logged in User."""
results = self.gitea.requests_get("/user/repos")
return [Repository.parse_response(self.gitea, result) for result in results]
results = self.requests_get("/user/repos")
return [Repository.parse_response(self, result) for result in results]
def get_users_following(self, username):
path = "/users/" + username + "/following"

Wyświetl plik

@ -7,7 +7,7 @@ from gitea import NotFoundException, AlreadyExistsException
# put a ".token" file into your directory containg only the token for gitea
@pytest.fixture
def instance(scope="module"):
try:
try:
g = Gitea("http://localhost:3000", open(".token", "r").read().strip())
print("Gitea Version: " + g.get_version())
print("API-Token belongs to user: " + g.get_user().username)
@ -200,3 +200,8 @@ def test_delete_user(instance):
user.delete()
with pytest.raises(NotFoundException) as e:
User.request(instance, test_user)
def test_get_accessible_repositories(instance):
repos = instance.get_accessible_repositories()
assert repos == []