code.gitea.io/gitea@v1.22.3/routers/web/repo/projects_test.go (about)

     1  // Copyright 2020 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package repo
     5  
     6  import (
     7  	"testing"
     8  
     9  	"code.gitea.io/gitea/models/unittest"
    10  	"code.gitea.io/gitea/services/contexttest"
    11  
    12  	"github.com/stretchr/testify/assert"
    13  )
    14  
    15  func TestCheckProjectBoardChangePermissions(t *testing.T) {
    16  	unittest.PrepareTestEnv(t)
    17  	ctx, _ := contexttest.MockContext(t, "user2/repo1/projects/1/2")
    18  	contexttest.LoadUser(t, ctx, 2)
    19  	contexttest.LoadRepo(t, ctx, 1)
    20  	ctx.SetParams(":id", "1")
    21  	ctx.SetParams(":boardID", "2")
    22  
    23  	project, board := checkProjectBoardChangePermissions(ctx)
    24  	assert.NotNil(t, project)
    25  	assert.NotNil(t, board)
    26  	assert.False(t, ctx.Written())
    27  }