diff options
Diffstat (limited to 'modules/repository/create_test.go')
-rw-r--r-- | modules/repository/create_test.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/repository/create_test.go b/modules/repository/create_test.go index 4e232a8609..b6a89a7ed6 100644 --- a/modules/repository/create_test.go +++ b/modules/repository/create_test.go @@ -10,6 +10,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/models/organization" "code.gitea.io/gitea/models/perm" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" @@ -22,13 +23,13 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) testTeamRepositories := func(teamID int64, repoIds []int64) { - team := unittest.AssertExistsAndLoadBean(t, &models.Team{ID: teamID}).(*models.Team) - assert.NoError(t, team.GetRepositories(&models.SearchOrgTeamOptions{}), "%s: GetRepositories", team.Name) + team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamID}).(*organization.Team) + assert.NoError(t, team.GetRepositoriesCtx(db.DefaultContext), "%s: GetRepositories", team.Name) assert.Len(t, team.Repos, team.NumRepos, "%s: len repo", team.Name) assert.Len(t, team.Repos, len(repoIds), "%s: repo count", team.Name) for i, rid := range repoIds { if rid > 0 { - assert.True(t, team.HasRepository(rid), "%s: HasRepository(%d) %d", rid, i) + assert.True(t, models.HasRepository(team, rid), "%s: HasRepository(%d) %d", rid, i) } } } @@ -38,13 +39,13 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) { assert.NoError(t, err, "GetUserByID") // Create org. - org := &models.Organization{ + org := &organization.Organization{ Name: "All_repo", IsActive: true, Type: user_model.UserTypeOrganization, Visibility: structs.VisibleTypePublic, } - assert.NoError(t, models.CreateOrganization(org, user), "CreateOrganization") + assert.NoError(t, organization.CreateOrganization(org, user), "CreateOrganization") // Check Owner team. ownerTeam, err := org.GetOwnerTeam() @@ -65,7 +66,7 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) { assert.NoError(t, err, "GetOwnerTeam") // Create teams and check repositories. - teams := []*models.Team{ + teams := []*organization.Team{ ownerTeam, { OrgID: org.ID, @@ -144,5 +145,5 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) { assert.NoError(t, models.DeleteRepository(user, org.ID, rid), "DeleteRepository %d", i) } } - assert.NoError(t, models.DeleteOrganization(db.DefaultContext, org), "DeleteOrganization") + assert.NoError(t, organization.DeleteOrganization(db.DefaultContext, org), "DeleteOrganization") } |