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"
|
|
|
|
)
|
|
|
|
|
2024-05-27 14:29:54 +05:30
|
|
|
func TestCheckProjectColumnChangePermissions(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")
|
2024-05-27 14:29:54 +05:30
|
|
|
ctx.SetParams(":columnID", "2")
|
2021-01-16 01:59:32 +05:30
|
|
|
|
2024-05-27 14:29:54 +05:30
|
|
|
project, column := checkProjectColumnChangePermissions(ctx)
|
2021-01-16 01:59:32 +05:30
|
|
|
assert.NotNil(t, project)
|
2024-05-27 14:29:54 +05:30
|
|
|
assert.NotNil(t, column)
|
2021-01-16 01:59:32 +05:30
|
|
|
assert.False(t, ctx.Written())
|
|
|
|
}
|