c572fcfe04
Rename the Go module path from code.gitea.io/gitea to git.mokoconsulting.tech/MokoConsulting/MokoGitea across the entire codebase. Scope: - go.mod module declaration - 2,235 Go source files (import paths) - Dockerfile WORKDIR and COPY paths - Swagger API templates - golangci.yml linter config External dependencies (code.gitea.io/gitea-vet, code.gitea.io/sdk/gitea, gitea.com/gitea/act, etc.) are intentionally NOT renamed — they are separate upstream modules. Closes #132 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
62 lines
2.1 KiB
Go
62 lines
2.1 KiB
Go
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package integration
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/setting"
|
|
api "git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/structs"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/tests"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestAPIExposedSettings(t *testing.T) {
|
|
defer tests.PrepareTestEnv(t)()
|
|
|
|
req := NewRequest(t, "GET", "/api/v1/settings/ui")
|
|
resp := MakeRequest(t, req, http.StatusOK)
|
|
|
|
ui := DecodeJSON(t, resp, &api.GeneralUISettings{})
|
|
assert.Len(t, ui.AllowedReactions, len(setting.UI.Reactions))
|
|
assert.ElementsMatch(t, setting.UI.Reactions, ui.AllowedReactions)
|
|
|
|
req = NewRequest(t, "GET", "/api/v1/settings/api")
|
|
resp = MakeRequest(t, req, http.StatusOK)
|
|
|
|
apiSettings := DecodeJSON(t, resp, &api.GeneralAPISettings{})
|
|
assert.Equal(t, &api.GeneralAPISettings{
|
|
MaxResponseItems: setting.API.MaxResponseItems,
|
|
DefaultPagingNum: setting.API.DefaultPagingNum,
|
|
DefaultGitTreesPerPage: setting.API.DefaultGitTreesPerPage,
|
|
DefaultMaxBlobSize: setting.API.DefaultMaxBlobSize,
|
|
DefaultMaxResponseSize: setting.API.DefaultMaxResponseSize,
|
|
}, apiSettings)
|
|
|
|
req = NewRequest(t, "GET", "/api/v1/settings/repository")
|
|
resp = MakeRequest(t, req, http.StatusOK)
|
|
|
|
repo := DecodeJSON(t, resp, &api.GeneralRepoSettings{})
|
|
assert.Equal(t, &api.GeneralRepoSettings{
|
|
MirrorsDisabled: !setting.Mirror.Enabled,
|
|
HTTPGitDisabled: setting.Repository.DisableHTTPGit,
|
|
MigrationsDisabled: setting.Repository.DisableMigrations,
|
|
TimeTrackingDisabled: false,
|
|
LFSDisabled: !setting.LFS.StartServer,
|
|
}, repo)
|
|
|
|
req = NewRequest(t, "GET", "/api/v1/settings/attachment")
|
|
resp = MakeRequest(t, req, http.StatusOK)
|
|
|
|
attachment := DecodeJSON(t, resp, &api.GeneralAttachmentSettings{})
|
|
assert.Equal(t, &api.GeneralAttachmentSettings{
|
|
Enabled: setting.Attachment.Enabled,
|
|
AllowedTypes: setting.Attachment.AllowedTypes,
|
|
MaxFiles: setting.Attachment.MaxFiles,
|
|
MaxSize: setting.Attachment.MaxSize,
|
|
}, attachment)
|
|
}
|