mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-14 04:09:29 +02:00
Move web/api context related testing function into a separate package (#26859)
Just like `models/unittest`, the testing helper functions should be in a separate package: `contexttest` And complete the TODO: > // TODO: move this function to other packages, because it depends on "models" package
This commit is contained in:
parent
fcb4941d47
commit
e8aae43f56
21 changed files with 244 additions and 244 deletions
|
@ -8,9 +8,9 @@ import (
|
|||
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/contexttest"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
|
||||
|
@ -19,7 +19,7 @@ import (
|
|||
|
||||
func TestNewUserPost_MustChangePassword(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
ctx, _ := test.MockContext(t, "admin/users/new")
|
||||
ctx, _ := contexttest.MockContext(t, "admin/users/new")
|
||||
|
||||
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{
|
||||
IsAdmin: true,
|
||||
|
@ -56,7 +56,7 @@ func TestNewUserPost_MustChangePassword(t *testing.T) {
|
|||
|
||||
func TestNewUserPost_MustChangePasswordFalse(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
ctx, _ := test.MockContext(t, "admin/users/new")
|
||||
ctx, _ := contexttest.MockContext(t, "admin/users/new")
|
||||
|
||||
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{
|
||||
IsAdmin: true,
|
||||
|
@ -93,7 +93,7 @@ func TestNewUserPost_MustChangePasswordFalse(t *testing.T) {
|
|||
|
||||
func TestNewUserPost_InvalidEmail(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
ctx, _ := test.MockContext(t, "admin/users/new")
|
||||
ctx, _ := contexttest.MockContext(t, "admin/users/new")
|
||||
|
||||
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{
|
||||
IsAdmin: true,
|
||||
|
@ -123,7 +123,7 @@ func TestNewUserPost_InvalidEmail(t *testing.T) {
|
|||
|
||||
func TestNewUserPost_VisibilityDefaultPublic(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
ctx, _ := test.MockContext(t, "admin/users/new")
|
||||
ctx, _ := contexttest.MockContext(t, "admin/users/new")
|
||||
|
||||
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{
|
||||
IsAdmin: true,
|
||||
|
@ -161,7 +161,7 @@ func TestNewUserPost_VisibilityDefaultPublic(t *testing.T) {
|
|||
|
||||
func TestNewUserPost_VisibilityPrivate(t *testing.T) {
|
||||
unittest.PrepareTestEnv(t)
|
||||
ctx, _ := test.MockContext(t, "admin/users/new")
|
||||
ctx, _ := contexttest.MockContext(t, "admin/users/new")
|
||||
|
||||
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{
|
||||
IsAdmin: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue