chore(refactor): run routers/api/v1/permissions/tests from tests/integration (#13157)

Changing the tests introduced in [this pull request](https://codeberg.org/forgejo/forgejo/pulls/12512) to run from the integration directory instead of running from a package, makes it possible to backport to v15.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13157
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
This commit is contained in:
limiting-factor 2026-06-21 21:43:57 +02:00 committed by Mathieu Fenniak
commit 65e35d2ba0
44 changed files with 202 additions and 207 deletions

View file

@ -0,0 +1,28 @@
// Copyright 2026 The Forgejo Authors.
// SPDX-License-Identifier: GPLv3-or-later
package integration
import (
"testing"
"forgejo.org/models/unittest"
"forgejo.org/modules/setting"
"forgejo.org/modules/test"
apiv1 "forgejo.org/routers/api/v1"
apiv1_permissions_tests "forgejo.org/routers/api/v1/permissions/tests"
)
func TestAPIv1Permissions(t *testing.T) {
defer test.MockVariableValue(&setting.Service.DefaultAllowCreateOrganization, true)()
defer test.MockVariableValue(&setting.IsInTesting, true)()
defer test.MockVariableValue(&setting.DisableGitHooks, false)()
unittest.PrepareTestEnv(t)
// because setting.IsInTesting == true, it will record the
// middleware sequence of each route it builds
apiv1.Routes()
apiv1_permissions_tests.APIv1Permissions(t)
}