forked from forgejo/forgejo
move repository deletion to service layer (#26948)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
3c0c279658
commit
4f32abaf94
53 changed files with 567 additions and 476 deletions
|
@ -7,7 +7,6 @@ import (
|
|||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
asymkey_model "code.gitea.io/gitea/models/asymkey"
|
||||
"code.gitea.io/gitea/models/organization"
|
||||
"code.gitea.io/gitea/models/perm"
|
||||
|
@ -19,6 +18,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
@ -248,7 +248,7 @@ func TestAddTeamPost(t *testing.T) {
|
|||
|
||||
AddTeamPost(ctx)
|
||||
|
||||
assert.True(t, models.HasRepository(team, re.ID))
|
||||
assert.True(t, repo_service.HasRepository(team, re.ID))
|
||||
assert.EqualValues(t, http.StatusSeeOther, ctx.Resp.Status())
|
||||
assert.Empty(t, ctx.Flash.ErrorMsg)
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ func TestAddTeamPost_NotAllowed(t *testing.T) {
|
|||
|
||||
AddTeamPost(ctx)
|
||||
|
||||
assert.False(t, models.HasRepository(team, re.ID))
|
||||
assert.False(t, repo_service.HasRepository(team, re.ID))
|
||||
assert.EqualValues(t, http.StatusSeeOther, ctx.Resp.Status())
|
||||
assert.NotEmpty(t, ctx.Flash.ErrorMsg)
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ func TestAddTeamPost_AddTeamTwice(t *testing.T) {
|
|||
AddTeamPost(ctx)
|
||||
|
||||
AddTeamPost(ctx)
|
||||
assert.True(t, models.HasRepository(team, re.ID))
|
||||
assert.True(t, repo_service.HasRepository(team, re.ID))
|
||||
assert.EqualValues(t, http.StatusSeeOther, ctx.Resp.Status())
|
||||
assert.NotEmpty(t, ctx.Flash.ErrorMsg)
|
||||
}
|
||||
|
@ -402,5 +402,5 @@ func TestDeleteTeam(t *testing.T) {
|
|||
|
||||
DeleteTeam(ctx)
|
||||
|
||||
assert.False(t, models.HasRepository(team, re.ID))
|
||||
assert.False(t, repo_service.HasRepository(team, re.ID))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue