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"
|
2024-02-27 12:42:22 +05:30
|
|
|
"code.gitea.io/gitea/services/contexttest"
|
2021-01-16 01:59:32 +05:30
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCheckProjectBoardChangePermissions(t *testing.T) {
|
2021-11-12 20:06:47 +05:30
|
|
|
unittest.PrepareTestEnv(t)
|
2023-09-01 16:56:07 +05:30
|
|
|
ctx, _ := contexttest.MockContext(t, "user2/repo1/projects/1/2")
|
|
|
|
contexttest.LoadUser(t, ctx, 2)
|
|
|
|
contexttest.LoadRepo(t, ctx, 1)
|
2021-01-16 01:59:32 +05:30
|
|
|
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())
|
|
|
|
}
|