mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-21 17:24:10 +00:00
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
This commit is contained in:
parent
fb8166c6c6
commit
719bddcd76
301 changed files with 3193 additions and 2919 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue