forgejo-sdk/gitea/settings_test.go
6543 3c8ff9d91c Update Default Settings for Tests (#435)
Update Default Settings for Tests

Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/435
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Andrew Thornton <art27@cantab.net>
2020-10-06 21:15:19 +00:00

47 lines
1.3 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,
}, 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)
}