diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-12-10 09:27:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 09:27:50 +0800 |
commit | 719bddcd76610a63dadc8555760072957a11cf30 (patch) | |
tree | 0df26092fba7e3e21444fe493e6b349473b6b0cb /routers/web/repo/settings_test.go | |
parent | fb8166c6c6b652a0e6fa98681780a6a71090faf3 (diff) | |
download | gitea-719bddcd76610a63dadc8555760072957a11cf30.tar.gz gitea-719bddcd76610a63dadc8555760072957a11cf30.zip |
Move repository model into models/repo (#17933)
* Some refactors related repository model
* Move more methods out of repository
* Move repository into models/repo
* Fix test
* Fix test
* some improvements
* Remove unnecessary function
Diffstat (limited to 'routers/web/repo/settings_test.go')
-rw-r--r-- | routers/web/repo/settings_test.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/routers/web/repo/settings_test.go b/routers/web/repo/settings_test.go index 5f997bc36b..fe6e9b52ba 100644 --- a/routers/web/repo/settings_test.go +++ b/routers/web/repo/settings_test.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/perm" + repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/context" @@ -112,7 +113,7 @@ func TestCollaborationPost(t *testing.T) { Type: user_model.UserTypeIndividual, } - re := &models.Repository{ + re := &repo_model.Repository{ ID: 2, Owner: u, } @@ -128,7 +129,7 @@ func TestCollaborationPost(t *testing.T) { assert.EqualValues(t, http.StatusFound, ctx.Resp.Status()) - exists, err := re.IsCollaborator(4) + exists, err := models.IsCollaborator(re.ID, 4) assert.NoError(t, err) assert.True(t, exists) } @@ -172,7 +173,7 @@ func TestCollaborationPost_AddCollaboratorTwice(t *testing.T) { Type: user_model.UserTypeIndividual, } - re := &models.Repository{ + re := &repo_model.Repository{ ID: 2, Owner: u, } @@ -188,7 +189,7 @@ func TestCollaborationPost_AddCollaboratorTwice(t *testing.T) { assert.EqualValues(t, http.StatusFound, ctx.Resp.Status()) - exists, err := re.IsCollaborator(4) + exists, err := models.IsCollaborator(re.ID, 4) assert.NoError(t, err) assert.True(t, exists) @@ -238,7 +239,7 @@ func TestAddTeamPost(t *testing.T) { OrgID: 26, } - re := &models.Repository{ + re := &repo_model.Repository{ ID: 43, Owner: org, OwnerID: 26, @@ -278,7 +279,7 @@ func TestAddTeamPost_NotAllowed(t *testing.T) { OrgID: 26, } - re := &models.Repository{ + re := &repo_model.Repository{ ID: 43, Owner: org, OwnerID: 26, @@ -319,7 +320,7 @@ func TestAddTeamPost_AddTeamTwice(t *testing.T) { OrgID: 26, } - re := &models.Repository{ + re := &repo_model.Repository{ ID: 43, Owner: org, OwnerID: 26, @@ -355,7 +356,7 @@ func TestAddTeamPost_NonExistentTeam(t *testing.T) { Type: user_model.UserTypeOrganization, } - re := &models.Repository{ + re := &repo_model.Repository{ ID: 43, Owner: org, OwnerID: 26, @@ -393,7 +394,7 @@ func TestDeleteTeam(t *testing.T) { OrgID: 3, } - re := &models.Repository{ + re := &repo_model.Repository{ ID: 3, Owner: org, OwnerID: 3, |