Esempio n. 1
0
def test_delete_repo():
    org = Organization(gitea, "test-org")
    repo = Repository(gitea, org, "test-repo")
    repo.delete()
    assert expect_not_exist(
        lambda: Repository(gitea, User(gitea, "test-user"), "test-repo"),
        (NotFoundException),
    ), "Repository test-repo should not exist"
Esempio n. 2
0
def test_create_issue(instance):
    org = Organization.request(instance, test_org)
    repo = Repository.request(instance, org.username, test_repo)
    issue = Issue.create_issue(instance, repo, "TestIssue", "Body text with this issue")
    assert issue.state == Issue.OPENED
    assert issue.title == "TestIssue"
    assert issue.body == "Body text with this issue"
Esempio n. 3
0
def test_full():
    user = User(gitea, "test-user")
    user.update_mail()
    org = Organization(gitea, "test-org")
    team = Team(org, "test-team")
    assert team.get_members() == []
    team.add(user)
    assert team.get_members() == [user]
    repo = Repository(gitea, org, "test-repo")
    assert team.get_repos() == []
    team.add(repo)
    assert team.get_repos() == [repo]
Esempio n. 4
0
def test_before_repo():
    assert expect_not_exist(
        lambda: Repository(gitea, User(gitea, "test-user"), "test-repo"),
        (NotFoundException),
    ), "Repository test-repo should not exist"
Esempio n. 5
0
def test_fail_get_non_existent_repo(instance):
    with pytest.raises(NotFoundException) as e:
        Repository.request(instance, test_user, test_repo)
Esempio n. 6
0
def test_delete_repo_orgowned(instance):
    org = Organization.request(instance, test_org)
    repo = Repository.request(instance, org.username, test_repo)
    repo.delete()
    with pytest.raises(NotFoundException) as e:
        Repository.request(instance, test_user, test_repo)
Esempio n. 7
0
def test_delete_repo_userowned(instance):
    user = User.request(instance, test_user)
    repo = Repository.request(instance, user.username, test_repo)
    repo.delete()
    with pytest.raises(NotFoundException) as e:
        Repository.request(instance, test_user, test_repo)