forgejo-sdk/gitea/user_test.go
6543 30636ade34 Add TestMyUser (#237)
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/237
Reviewed-by: lafriks <lafriks@noreply.gitea.io>
Reviewed-by: Andrew Thornton <art27@cantab.net>
2020-01-28 06:11:26 +00:00

26 lines
688 B
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 TestMyUser(t *testing.T) {
log.Println("== TestMyUser ==")
c := newTestClient()
user, err := c.GetMyUserInfo()
assert.NoError(t, err)
assert.EqualValues(t, 1, user.ID)
assert.EqualValues(t, "test01", user.UserName)
assert.EqualValues(t, "test01@gitea.io", user.Email)
assert.EqualValues(t, "", user.FullName)
assert.EqualValues(t, getGiteaURL()+"/user/avatar/test01/-1", user.AvatarURL)
assert.Equal(t, true, user.IsAdmin)
}