Exemplo n.º 1
0
def test_edit_org_fields_and_commit(instance):
    org = Organization.request(instance, test_org)
    org.description = "some thing other man"
    org.location = "somewehre new"
    org.visibility = "public"
    org.website = "http:\\\\testurl.com"
    org.commit()
    org2 = Organization.request(instance, test_org)
    assert org2.name == test_org
    assert org2.description == "some thing other man"
    assert org2.location == "somewehre new"
    # assert org2.visibility == "private" # after commiting, this field just vanishes (Bug?)
    assert org2.website == "http:\\\\testurl.com"
Exemplo n.º 2
0
def test_create_repo():
    org = Organization(gitea, "test-org")
    repo = gitea.create_repo(org, "test-repo", "descr")
    assert repo.description == "descr"
    assert repo.owner == org
    assert repo.name == "test-repo"
    assert not repo.private
Exemplo n.º 3
0
def test_create_repo_orgowned(instance):
    org = Organization.request(instance, test_org)
    repo = instance.create_repo(org, test_repo, "descr")
    assert repo.description == "descr"
    assert repo.owner == org
    assert repo.name == test_repo
    assert not repo.private
Exemplo n.º 4
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"
Exemplo n.º 5
0
def test_create_branch(instance):
    org = Organization.request(instance, test_org)
    repo = org.get_repository(test_repo)
    branches = repo.get_branches()
    master = [b for b in branches if b.name == "master"]
    assert len(master) > 0
    repo.add_branch(master[0], "test_branch")
Exemplo n.º 6
0
def test_list_branches(instance):
    org = Organization.request(instance, test_org)
    repo = org.get_repository(test_repo)
    branches = repo.get_branches()
    assert len(branches) > 0
    master = [b for b in branches if b.name == "master"]
    assert len(master) > 0
Exemplo n.º 7
0
def test_delete_team():
    org = Organization(gitea, "test-org")
    team = Team(org, "test-team")
    team.delete()
    assert expect_not_exist(
        lambda: Team(org, "test-team"),
        (NotFoundException)), "Team test-team should not exist"
Exemplo n.º 8
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"
Exemplo n.º 9
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]
Exemplo n.º 10
0
def test_create_team():
    org = Organization(gitea, "test-org")
    team = gitea.create_team(org, "test-team", "descr")
    assert team.name == "test-team"
    assert team.description == "descr"
    assert team.organization == org
Exemplo n.º 11
0
def test_non_changable_field(instance):
    org = Organization.request(instance, test_org)
    with pytest.raises(AttributeError) as e:
        org.id = 55
Exemplo n.º 12
0
def test_before_org():
    assert expect_not_exist(
        lambda: Organization(gitea, "test-org"),
        (NotFoundException)), "Organization test-org should not exist"
Exemplo n.º 13
0
def test_delete_team(instance):
    org = Organization.request(instance, test_org)
    team = org.get_team(test_team)
    team.delete()
    with pytest.raises(NotFoundException) as e:
        team = org.get_team(test_team)
Exemplo n.º 14
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)
Exemplo n.º 15
0
def test_create_team(instance):
    org = Organization.request(instance, test_org)
    team = instance.create_team(org, test_team, "descr")
    assert team.name == test_team
    assert team.description == "descr"
    assert team.organization == org
Exemplo n.º 16
0
def test_delete_org():
    org = Organization(gitea, "test-org")
    org.delete()
    assert expect_not_exist(
        lambda: Organization(gitea, "test-org"),
        (NotFoundException)), "Organization test-org should not exist"
Exemplo n.º 17
0
def test_delete_org(instance):
    org = Organization.request(instance, test_org)
    org.delete()
    with pytest.raises(NotFoundException) as e:
        Organization.request(instance, test_org)
Exemplo n.º 18
0
def test_before_team():
    assert expect_not_exist(
        lambda: Team(gitea, Organization(gitea, "test-org"), "test-team"),
        (NotFoundException),
    ), "Team test-team should not exist"
Exemplo n.º 19
0
def test_fail_get_non_existent_org(instance):
    with pytest.raises(NotFoundException) as e:
        Organization.request(instance, test_org)