kopia lustrzana https://github.com/Langenfeld/py-gitea
testing of secondary emailadress
rodzic
00c2f97063
commit
257abeb13b
|
@ -184,7 +184,7 @@ class Repository(GiteaApiObject):
|
||||||
|
|
||||||
def get_issues_state(self, state) -> List[GiteaApiObject]:
|
def get_issues_state(self, state) -> List[GiteaApiObject]:
|
||||||
"""Get issues of state Issue.open or Issue.closed of a repository."""
|
"""Get issues of state Issue.open or Issue.closed of a repository."""
|
||||||
assert state in [Issue.open, Issue.closed]
|
assert state in [Issue.OPENED, Issue.CLOSED]
|
||||||
index = 1
|
index = 1
|
||||||
issues = []
|
issues = []
|
||||||
while True:
|
while True:
|
||||||
|
@ -587,7 +587,7 @@ class Gitea:
|
||||||
def get_user_by_email(self, email: str) -> User:
|
def get_user_by_email(self, email: str) -> User:
|
||||||
users = self.get_users()
|
users = self.get_users()
|
||||||
for user in users:
|
for user in users:
|
||||||
if user.email == email:
|
if user.email == email or email in user.emails:
|
||||||
return user
|
return user
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
10
test_api.py
10
test_api.py
|
@ -119,12 +119,18 @@ def test_create_issue():
|
||||||
assert issue.body == "Body text with this issue"
|
assert issue.body == "Body text with this issue"
|
||||||
|
|
||||||
def test_delete_repo_userowned():
|
def test_delete_repo_userowned():
|
||||||
org = User.request(gitea, test_user)
|
user = User.request(gitea, test_user)
|
||||||
repo = Repository.request(gitea, org.username, test_repo)
|
repo = Repository.request(gitea, user.username, test_repo)
|
||||||
repo.delete()
|
repo.delete()
|
||||||
with pytest.raises(NotFoundException) as e:
|
with pytest.raises(NotFoundException) as e:
|
||||||
Repository.request(gitea, test_user, test_repo)
|
Repository.request(gitea, test_user, test_repo)
|
||||||
|
|
||||||
|
def test_secundary_email():
|
||||||
|
SECONDARYMAIL = "secondarytest@test.org" # set up with real email
|
||||||
|
sec_user = gitea.get_user_by_email(SECONDARYMAIL)
|
||||||
|
assert SECONDARYMAIL in sec_user.emails
|
||||||
|
assert sec_user.username == "test"
|
||||||
|
|
||||||
def test_delete_repo_orgowned():
|
def test_delete_repo_orgowned():
|
||||||
org = Organization.request(gitea, test_org)
|
org = Organization.request(gitea, test_org)
|
||||||
repo = Repository.request(gitea, org.username, test_repo)
|
repo = Repository.request(gitea, org.username, test_repo)
|
||||||
|
|
Ładowanie…
Reference in New Issue