forgejo-sdk/forgejo/user_settings_test.go
Martijn van der Kleijn ae325d4bec Correct misspelling Forgjo
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-05-03 17:43:42 +02:00

52 lines
1.3 KiB
Go

// Copyright 2024 The Forgejo Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// Copyright 2021 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 forgejo
import (
"log"
"testing"
"github.com/stretchr/testify/assert"
)
func TestUserSettings(t *testing.T) {
log.Println("== TestUserSettings ==")
c := newTestClient()
userConf, _, err := c.GetUserSettings()
assert.NoError(t, err)
assert.NotNil(t, userConf)
assert.EqualValues(t, UserSettings{
Theme: "forgejo-auto",
HideEmail: false,
HideActivity: false,
}, *userConf)
userConf, _, err = c.UpdateUserSettings(UserSettingsOptions{
FullName: OptionalString("Admin User on Test"),
Language: OptionalString("de_de"),
HideEmail: OptionalBool(true),
})
assert.NoError(t, err)
assert.NotNil(t, userConf)
assert.EqualValues(t, UserSettings{
FullName: "Admin User on Test",
Theme: "forgejo-auto",
Language: "de_de",
HideEmail: true,
HideActivity: false,
}, *userConf)
_, _, err = c.UpdateUserSettings(UserSettingsOptions{
FullName: OptionalString(""),
Language: OptionalString(""),
HideEmail: OptionalBool(false),
})
assert.NoError(t, err)
}