Files
MokoGitea/tests/integration/api_settings_test.go
Jonathan Miller c572fcfe04
PR RC Release / Build RC Release (pull_request) Failing after 0s
Branch Policy Check / Verify merge target (pull_request) Failing after 0s
chore(core): rename Go module from code.gitea.io/gitea to MokoGitea namespace
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>
2026-05-25 00:22:38 -05:00

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)
}