diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2021-11-16 16:53:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 16:53:21 +0800 |
commit | 81926d61db3dac223a75ea49eab893b25a089587 (patch) | |
tree | 627d2f19a008089f3a688e9a94a2cc8d2017afe2 /routers/api/v1/repo | |
parent | 23bd7b1211a80aa3b0dcb60ec4a1c0089ff28dd4 (diff) | |
download | gitea-81926d61db3dac223a75ea49eab893b25a089587.tar.gz gitea-81926d61db3dac223a75ea49eab893b25a089587.zip |
Decouple unit test, remove intermediate `unittestbridge` package (#17662)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r-- | routers/api/v1/repo/hook_test.go | 5 | ||||
-rw-r--r-- | routers/api/v1/repo/repo_test.go | 9 |
2 files changed, 6 insertions, 8 deletions
diff --git a/routers/api/v1/repo/hook_test.go b/routers/api/v1/repo/hook_test.go index ff0aaf2938..07f1532f82 100644 --- a/routers/api/v1/repo/hook_test.go +++ b/routers/api/v1/repo/hook_test.go @@ -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)) } diff --git a/routers/api/v1/repo/repo_test.go b/routers/api/v1/repo/repo_test.go index b992b93fd4..4d4093582b 100644 --- a/routers/api/v1/repo/repo_test.go +++ b/routers/api/v1/repo/repo_test.go @@ -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)) } |