2023-01-20 17:12:33 +05:30
|
|
|
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
package org_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models/unittest"
|
|
|
|
"code.gitea.io/gitea/routers/web/org"
|
2024-02-27 12:42:22 +05:30
|
|
|
"code.gitea.io/gitea/services/contexttest"
|
2023-01-20 17:12:33 +05:30
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2024-05-27 14:29:54 +05:30
|
|
|
func TestCheckProjectColumnChangePermissions(t *testing.T) {
|
2023-01-20 17:12:33 +05:30
|
|
|
unittest.PrepareTestEnv(t)
|
2023-09-01 16:56:07 +05:30
|
|
|
ctx, _ := contexttest.MockContext(t, "user2/-/projects/4/4")
|
|
|
|
contexttest.LoadUser(t, ctx, 2)
|
2023-01-20 17:12:33 +05:30
|
|
|
ctx.ContextUser = ctx.Doer // user2
|
|
|
|
ctx.SetParams(":id", "4")
|
2024-05-27 14:29:54 +05:30
|
|
|
ctx.SetParams(":columnID", "4")
|
2023-01-20 17:12:33 +05:30
|
|
|
|
2024-05-27 14:29:54 +05:30
|
|
|
project, column := org.CheckProjectColumnChangePermissions(ctx)
|
2023-01-20 17:12:33 +05:30
|
|
|
assert.NotNil(t, project)
|
2024-05-27 14:29:54 +05:30
|
|
|
assert.NotNil(t, column)
|
2023-01-20 17:12:33 +05:30
|
|
|
assert.False(t, ctx.Written())
|
|
|
|
}
|