예제 #1
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]
예제 #2
0
def test_create_repo_userowned(instance):
    org = User.request(instance, test_user)
    repo = instance.create_repo(org, test_repo, "user owned repo")
    assert repo.description == "user owned repo"
    assert repo.owner == org
    assert repo.name == test_repo
    assert not repo.private
예제 #3
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"
예제 #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
파일: tests.py 프로젝트: N3Q/py-gitea
def test_before_user():
    # This should not work currently
    assert expect_not_exist(
        lambda: User(gitea, "test-user"),
        (NotFoundException)), "User test-user should not exist"
예제 #6
0
파일: tests.py 프로젝트: N3Q/py-gitea
def test_delete_user():
    user = User(gitea, "test-user")
    user.delete()
    assert expect_not_exist(
        lambda: User(gitea, "test-user"),
        (NotFoundException)), "User test-user should not exist"
예제 #7
0
def test_fail_get_non_existent_user(instance):
    with pytest.raises(NotFoundException) as e:
        User.request(instance, test_user)
예제 #8
0
def test_delete_user(instance):
    user = User.request(instance, test_user)
    user.delete()
    with pytest.raises(NotFoundException) as e:
        User.request(instance, test_user)
예제 #9
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)