forked from plouc/go-gitlab-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
users_test.go
53 lines (44 loc) · 1.26 KB
/
users_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package gogitlab
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestUsers(t *testing.T) {
ts, gitlab := Stub("stubs/users/index.json")
users, err := gitlab.Users(0, 0)
assert.Equal(t, err, nil)
assert.Equal(t, len(users), 2)
defer ts.Close()
}
func TestUser(t *testing.T) {
ts, gitlab := Stub("stubs/users/show.json")
user, err := gitlab.User("plouc")
assert.Equal(t, err, nil)
assert.IsType(t, new(User), user)
assert.Equal(t, user.Id, 6)
assert.Equal(t, user.Username, "plouc")
assert.Equal(t, user.Name, "Raphaël Benitte")
assert.Equal(t, user.Bio, "")
assert.Equal(t, user.Skype, "")
assert.Equal(t, user.LinkedIn, "")
assert.Equal(t, user.Twitter, "")
assert.Equal(t, user.ThemeId, 2)
assert.Equal(t, user.State, "active")
assert.Equal(t, user.CreatedAt, "2001-01-01T00:00:00Z")
assert.Equal(t, user.ExternUid, "uid=plouc")
assert.Equal(t, user.Provider, "ldap")
defer ts.Close()
}
func TestDeleteUser(t *testing.T) {
ts, gitlab := Stub("")
err := gitlab.DeleteUser("1")
assert.Equal(t, err, nil)
defer ts.Close()
}
func TestCurrentUser(t *testing.T) {
ts, gitlab := Stub("stubs/users/current.json")
user, err := gitlab.CurrentUser()
assert.Equal(t, err, nil)
assert.Equal(t, user.Username, "john_smith")
defer ts.Close()
}