mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09: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:
		| @@ -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, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user