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]
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
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"
def test_before_repo(): assert expect_not_exist( lambda: Repository(gitea, User(gitea, "test-user"), "test-repo"), (NotFoundException), ), "Repository test-repo should not exist"
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"
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"
def test_fail_get_non_existent_user(instance): with pytest.raises(NotFoundException) as e: User.request(instance, test_user)
def test_delete_user(instance): user = User.request(instance, test_user) user.delete() with pytest.raises(NotFoundException) as e: User.request(instance, test_user)
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)