This commit is contained in:
@@ -7,9 +7,9 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/tests"
|
||||
"gitea.dev/modules/setting"
|
||||
api "gitea.dev/modules/structs"
|
||||
"gitea.dev/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -17,19 +17,17 @@ import (
|
||||
func TestAPIExposedSettings(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
ui := new(api.GeneralUISettings)
|
||||
req := NewRequest(t, "GET", "/api/v1/settings/ui")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
DecodeJSON(t, resp, &ui)
|
||||
ui := DecodeJSON(t, resp, &api.GeneralUISettings{})
|
||||
assert.Len(t, ui.AllowedReactions, len(setting.UI.Reactions))
|
||||
assert.ElementsMatch(t, setting.UI.Reactions, ui.AllowedReactions)
|
||||
|
||||
apiSettings := new(api.GeneralAPISettings)
|
||||
req = NewRequest(t, "GET", "/api/v1/settings/api")
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
DecodeJSON(t, resp, &apiSettings)
|
||||
apiSettings := DecodeJSON(t, resp, &api.GeneralAPISettings{})
|
||||
assert.Equal(t, &api.GeneralAPISettings{
|
||||
MaxResponseItems: setting.API.MaxResponseItems,
|
||||
DefaultPagingNum: setting.API.DefaultPagingNum,
|
||||
@@ -38,11 +36,10 @@ func TestAPIExposedSettings(t *testing.T) {
|
||||
DefaultMaxResponseSize: setting.API.DefaultMaxResponseSize,
|
||||
}, apiSettings)
|
||||
|
||||
repo := new(api.GeneralRepoSettings)
|
||||
req = NewRequest(t, "GET", "/api/v1/settings/repository")
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
DecodeJSON(t, resp, &repo)
|
||||
repo := DecodeJSON(t, resp, &api.GeneralRepoSettings{})
|
||||
assert.Equal(t, &api.GeneralRepoSettings{
|
||||
MirrorsDisabled: !setting.Mirror.Enabled,
|
||||
HTTPGitDisabled: setting.Repository.DisableHTTPGit,
|
||||
@@ -51,11 +48,10 @@ func TestAPIExposedSettings(t *testing.T) {
|
||||
LFSDisabled: !setting.LFS.StartServer,
|
||||
}, repo)
|
||||
|
||||
attachment := new(api.GeneralAttachmentSettings)
|
||||
req = NewRequest(t, "GET", "/api/v1/settings/attachment")
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
DecodeJSON(t, resp, &attachment)
|
||||
attachment := DecodeJSON(t, resp, &api.GeneralAttachmentSettings{})
|
||||
assert.Equal(t, &api.GeneralAttachmentSettings{
|
||||
Enabled: setting.Attachment.Enabled,
|
||||
AllowedTypes: setting.Attachment.AllowedTypes,
|
||||
|
||||
Reference in New Issue
Block a user