mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08: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:
		@@ -7,7 +7,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/gitea/models/unittest"
 | 
			
		||||
	"code.gitea.io/gitea/modules/test"
 | 
			
		||||
	"code.gitea.io/gitea/modules/contexttest"
 | 
			
		||||
	"code.gitea.io/gitea/routers/web/org"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
@@ -15,8 +15,8 @@ import (
 | 
			
		||||
 | 
			
		||||
func TestCheckProjectBoardChangePermissions(t *testing.T) {
 | 
			
		||||
	unittest.PrepareTestEnv(t)
 | 
			
		||||
	ctx, _ := test.MockContext(t, "user2/-/projects/4/4")
 | 
			
		||||
	test.LoadUser(t, ctx, 2)
 | 
			
		||||
	ctx, _ := contexttest.MockContext(t, "user2/-/projects/4/4")
 | 
			
		||||
	contexttest.LoadUser(t, ctx, 2)
 | 
			
		||||
	ctx.ContextUser = ctx.Doer // user2
 | 
			
		||||
	ctx.SetParams(":id", "4")
 | 
			
		||||
	ctx.SetParams(":boardID", "4")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user