mirror of
https://gitea.com/gitea/go-sdk.git
synced 2024-06-02 10:11:26 +05:30
83c73e79a5
- Update Gitea image version to `1.22.0-rc1` in testing workflow - Increase the number of milestones to be checked in the test from `2` to `3` - Modify the theme setting from `auto` to `gitea-auto` in user settings test - Update the Avatar URL in user test to use `http://gitea:3000/avatars/` instead of `https://secure.gravatar.com/avatar/` - Increase the number of user emails to be checked in the test from `2` to `3` Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/663 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com> Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
// 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 gitea
|
|
|
|
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: "gitea-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: "gitea-auto",
|
|
Language: "de_de",
|
|
HideEmail: true,
|
|
HideActivity: false,
|
|
}, *userConf)
|
|
|
|
_, _, err = c.UpdateUserSettings(UserSettingsOptions{
|
|
FullName: OptionalString(""),
|
|
Language: OptionalString(""),
|
|
HideEmail: OptionalBool(false),
|
|
})
|
|
assert.NoError(t, err)
|
|
}
|