diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-09-19 19:49:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-19 19:49:59 +0800 |
commit | a4bfef265d9e512830350635a0489c2cdcd6508f (patch) | |
tree | 1e3c2ec94276dfcb2f8ba73a2ac075ba39c4a34a /routers/web/admin/users_test.go | |
parent | 462306e263db5a809dbe2cdf62e99307aeff28de (diff) | |
download | gitea-a4bfef265d9e512830350635a0489c2cdcd6508f.tar.gz gitea-a4bfef265d9e512830350635a0489c2cdcd6508f.zip |
Move db related basic functions to models/db (#17075)
* Move db related basic functions to models/db
* Fix lint
* Fix lint
* Fix test
* Fix lint
* Fix lint
* revert unnecessary change
* Fix test
* Fix wrong replace string
* Use *Context
* Correct committer spelling and fix wrong replaced words
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'routers/web/admin/users_test.go')
-rw-r--r-- | routers/web/admin/users_test.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/routers/web/admin/users_test.go b/routers/web/admin/users_test.go index 3d0b11a774..022d8f662c 100644 --- a/routers/web/admin/users_test.go +++ b/routers/web/admin/users_test.go @@ -8,6 +8,7 @@ import ( "testing" "code.gitea.io/gitea/models" + "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/test" @@ -19,10 +20,10 @@ import ( func TestNewUserPost_MustChangePassword(t *testing.T) { - models.PrepareTestEnv(t) + db.PrepareTestEnv(t) ctx := test.MockContext(t, "admin/users/new") - u := models.AssertExistsAndLoadBean(t, &models.User{ + u := db.AssertExistsAndLoadBean(t, &models.User{ IsAdmin: true, ID: 2, }).(*models.User) @@ -56,10 +57,10 @@ func TestNewUserPost_MustChangePassword(t *testing.T) { } func TestNewUserPost_MustChangePasswordFalse(t *testing.T) { - models.PrepareTestEnv(t) + db.PrepareTestEnv(t) ctx := test.MockContext(t, "admin/users/new") - u := models.AssertExistsAndLoadBean(t, &models.User{ + u := db.AssertExistsAndLoadBean(t, &models.User{ IsAdmin: true, ID: 2, }).(*models.User) @@ -93,10 +94,10 @@ func TestNewUserPost_MustChangePasswordFalse(t *testing.T) { } func TestNewUserPost_InvalidEmail(t *testing.T) { - models.PrepareTestEnv(t) + db.PrepareTestEnv(t) ctx := test.MockContext(t, "admin/users/new") - u := models.AssertExistsAndLoadBean(t, &models.User{ + u := db.AssertExistsAndLoadBean(t, &models.User{ IsAdmin: true, ID: 2, }).(*models.User) @@ -123,10 +124,10 @@ func TestNewUserPost_InvalidEmail(t *testing.T) { } func TestNewUserPost_VisibilityDefaultPublic(t *testing.T) { - models.PrepareTestEnv(t) + db.PrepareTestEnv(t) ctx := test.MockContext(t, "admin/users/new") - u := models.AssertExistsAndLoadBean(t, &models.User{ + u := db.AssertExistsAndLoadBean(t, &models.User{ IsAdmin: true, ID: 2, }).(*models.User) @@ -161,10 +162,10 @@ func TestNewUserPost_VisibilityDefaultPublic(t *testing.T) { } func TestNewUserPost_VisibilityPrivate(t *testing.T) { - models.PrepareTestEnv(t) + db.PrepareTestEnv(t) ctx := test.MockContext(t, "admin/users/new") - u := models.AssertExistsAndLoadBean(t, &models.User{ + u := db.AssertExistsAndLoadBean(t, &models.User{ IsAdmin: true, ID: 2, }).(*models.User) |