go-sdk/gitea/settings_test.go
6543 13d2d23dfc
All checks were successful
continuous-integration/drone/push Build is passing
Update Structs (#524)
Update gitea structs to [365c4e9316bbcc8bdf9cf68ef237bf18ae8db315](365c4e9316) state.

use:
`git log --name-only --pretty=oneline --full-index v1.14.0..HEAD | grep -vE '^[0-9a-f]{40} ' | sort | uniq | grep ^modules/structs`
and
`git diff --full-index v1.13.0..HEAD -- modules/structs`
if you like to check yourselve

Reviewed-on: #524
Reviewed-by: Norwin <noerw@noreply.gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-committed-by: 6543 <6543@obermui.de>
2021-07-01 23:10:21 +08:00

49 lines
1.4 KiB
Go

// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package gitea
import (
"log"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetGlobalSettings(t *testing.T) {
log.Println("== TestGetGlobalSettings ==")
c := newTestClient()
uiSettings, _, err := c.GetGlobalUISettings()
assert.NoError(t, err)
expectedAllowedReactions := []string{"+1", "-1", "laugh", "hooray", "confused", "heart", "rocket", "eyes"}
assert.ElementsMatch(t, expectedAllowedReactions, uiSettings.AllowedReactions)
repoSettings, _, err := c.GetGlobalRepoSettings()
assert.NoError(t, err)
assert.EqualValues(t, &GlobalRepoSettings{
HTTPGitDisabled: false,
MirrorsDisabled: false,
LFSDisabled: true,
}, repoSettings)
apiSettings, _, err := c.GetGlobalAPISettings()
assert.NoError(t, err)
assert.EqualValues(t, &GlobalAPISettings{
MaxResponseItems: 50,
DefaultPagingNum: 30,
DefaultGitTreesPerPage: 1000,
DefaultMaxBlobSize: 10485760,
}, apiSettings)
attachSettings, _, err := c.GetGlobalAttachmentSettings()
assert.NoError(t, err)
assert.EqualValues(t, &GlobalAttachmentSettings{
Enabled: true,
AllowedTypes: ".docx,.gif,.gz,.jpeg,.jpg,.log,.pdf,.png,.pptx,.txt,.xlsx,.zip",
MaxSize: 4,
MaxFiles: 5,
}, attachSettings)
}