示例#1
0
文件: tests.py 项目: N3Q/py-gitea
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"
示例#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"
示例#3
0
文件: tests.py 项目: N3Q/py-gitea
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]
示例#4
0
文件: tests.py 项目: N3Q/py-gitea
def test_before_repo():
    assert expect_not_exist(
        lambda: Repository(gitea, User(gitea, "test-user"), "test-repo"),
        (NotFoundException),
    ), "Repository test-repo should not exist"
示例#5
0
def test_fail_get_non_existent_repo(instance):
    with pytest.raises(NotFoundException) as e:
        Repository.request(instance, test_user, test_repo)
示例#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)
示例#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)