You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

projects_test.go 698B

12345678910111213141516171819202122232425262728
  1. // Copyright 2022 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package org_test
  4. import (
  5. "testing"
  6. "code.gitea.io/gitea/models/unittest"
  7. "code.gitea.io/gitea/modules/test"
  8. "code.gitea.io/gitea/routers/web/org"
  9. "github.com/stretchr/testify/assert"
  10. )
  11. func TestCheckProjectBoardChangePermissions(t *testing.T) {
  12. unittest.PrepareTestEnv(t)
  13. ctx := test.MockContext(t, "user2/-/projects/4/4")
  14. test.LoadUser(t, ctx, 2)
  15. ctx.ContextUser = ctx.Doer // user2
  16. ctx.SetParams(":id", "4")
  17. ctx.SetParams(":boardID", "4")
  18. project, board := org.CheckProjectBoardChangePermissions(ctx)
  19. assert.NotNil(t, project)
  20. assert.NotNil(t, board)
  21. assert.False(t, ctx.Written())
  22. }