mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-10 22:42:25 +00:00
7fae3d5db3
Adds REST APIs for project boards for repo, org and user scopes, using as much shared code as possible for all 3 scopes. Fixes: https://github.com/go-gitea/gitea/issues/14299 Fixes: https://github.com/go-gitea/gitea/issues/31769 Fixes: https://github.com/go-gitea/gitea/issues/35921 Replaces: https://github.com/go-gitea/gitea/pull/37518 Replaces: https://github.com/go-gitea/gitea/pull/36008 Replaces: https://github.com/go-gitea/gitea/pull/28111 Replaces: https://github.com/go-gitea/gitea/pull/31768 Signed-off-by: silverwind <me@silverwind.io> Co-authored-by: Supen.Huang <supen.huang@qq.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Ember <ember@mubergacres.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: beardev-in <abhinav.edulakanti@gmail.com>
30 lines
704 B
Go
30 lines
704 B
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package org_test
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"gitea.dev/models/unittest"
|
|
"gitea.dev/routers/web/org"
|
|
"gitea.dev/services/contexttest"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestChangeProjectStatusRejectsForeignProjects(t *testing.T) {
|
|
unittest.PrepareTestEnv(t)
|
|
// project 4 is owned by user2 not user1
|
|
ctx, _ := contexttest.MockContext(t, "user1/-/projects/4/close")
|
|
contexttest.LoadUser(t, ctx, 1)
|
|
ctx.ContextUser = ctx.Doer
|
|
ctx.SetPathParam("action", "close")
|
|
ctx.SetPathParam("id", "4")
|
|
|
|
org.ChangeProjectStatus(ctx)
|
|
|
|
assert.Equal(t, http.StatusNotFound, ctx.Resp.WrittenStatus())
|
|
}
|