2021-01-16 01:59:32 +05:30
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2021-01-16 01:59:32 +05:30
|
|
|
|
|
|
|
package repo
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-11-12 20:06:47 +05:30
|
|
|
"code.gitea.io/gitea/models/unittest"
|
2021-01-16 01:59:32 +05:30
|
|
|
"code.gitea.io/gitea/modules/test"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCheckProjectBoardChangePermissions(t *testing.T) {
|
2021-11-12 20:06:47 +05:30
|
|
|
unittest.PrepareTestEnv(t)
|
2023-06-18 13:29:09 +05:30
|
|
|
ctx, _ := test.MockContext(t, "user2/repo1/projects/1/2")
|
2021-01-16 01:59:32 +05:30
|
|
|
test.LoadUser(t, ctx, 2)
|
|
|
|
test.LoadRepo(t, ctx, 1)
|
|
|
|
ctx.SetParams(":id", "1")
|
|
|
|
ctx.SetParams(":boardID", "2")
|
|
|
|
|
|
|
|
project, board := checkProjectBoardChangePermissions(ctx)
|
|
|
|
assert.NotNil(t, project)
|
|
|
|
assert.NotNil(t, board)
|
|
|
|
assert.False(t, ctx.Written())
|
|
|
|
}
|