2023-01-20 04:42:33 -07:00
|
|
|
// 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 00:12:22 -07:00
|
|
|
"code.gitea.io/gitea/services/contexttest"
|
2023-01-20 04:42:33 -07:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2024-05-27 02:59:54 -06:00
|
|
|
func TestCheckProjectColumnChangePermissions(t *testing.T) {
|
2023-01-20 04:42:33 -07:00
|
|
|
unittest.PrepareTestEnv(t)
|
2023-09-01 05:26:07 -06:00
|
|
|
ctx, _ := contexttest.MockContext(t, "user2/-/projects/4/4")
|
|
|
|
contexttest.LoadUser(t, ctx, 2)
|
2023-01-20 04:42:33 -07:00
|
|
|
ctx.ContextUser = ctx.Doer // user2
|
2024-06-18 16:32:45 -06:00
|
|
|
ctx.SetPathParam(":id", "4")
|
|
|
|
ctx.SetPathParam(":columnID", "4")
|
2023-01-20 04:42:33 -07:00
|
|
|
|
2024-05-27 02:59:54 -06:00
|
|
|
project, column := org.CheckProjectColumnChangePermissions(ctx)
|
2023-01-20 04:42:33 -07:00
|
|
|
assert.NotNil(t, project)
|
2024-05-27 02:59:54 -06:00
|
|
|
assert.NotNil(t, column)
|
2023-01-20 04:42:33 -07:00
|
|
|
assert.False(t, ctx.Written())
|
|
|
|
}
|