mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Decouple unit test, remove intermediate unittestbridge
package (#17662)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/models/webhook"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
@@ -28,8 +27,8 @@ func TestTestHook(t *testing.T) {
|
||||
TestHook(&context.APIContext{Context: ctx, Org: nil})
|
||||
assert.EqualValues(t, http.StatusNoContent, ctx.Resp.Status())
|
||||
|
||||
db.AssertExistsAndLoadBean(t, &webhook.HookTask{
|
||||
unittest.AssertExistsAndLoadBean(t, &webhook.HookTask{
|
||||
RepoID: 1,
|
||||
HookID: 1,
|
||||
}, db.Cond("is_delivered=?", false))
|
||||
}, unittest.Cond("is_delivered=?", false))
|
||||
}
|
||||
|
@@ -9,7 +9,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
@@ -61,9 +60,9 @@ func TestRepoEdit(t *testing.T) {
|
||||
Edit(apiCtx)
|
||||
|
||||
assert.EqualValues(t, http.StatusOK, ctx.Resp.Status())
|
||||
db.AssertExistsAndLoadBean(t, &models.Repository{
|
||||
unittest.AssertExistsAndLoadBean(t, &models.Repository{
|
||||
ID: 1,
|
||||
}, db.Cond("name = ? AND is_archived = 1", *opts.Name))
|
||||
}, unittest.Cond("name = ? AND is_archived = 1", *opts.Name))
|
||||
}
|
||||
|
||||
func TestRepoEditNameChange(t *testing.T) {
|
||||
@@ -83,7 +82,7 @@ func TestRepoEditNameChange(t *testing.T) {
|
||||
Edit(apiCtx)
|
||||
assert.EqualValues(t, http.StatusOK, ctx.Resp.Status())
|
||||
|
||||
db.AssertExistsAndLoadBean(t, &models.Repository{
|
||||
unittest.AssertExistsAndLoadBean(t, &models.Repository{
|
||||
ID: 1,
|
||||
}, db.Cond("name = ?", opts.Name))
|
||||
}, unittest.Cond("name = ?", opts.Name))
|
||||
}
|
||||
|
Reference in New Issue
Block a user