-
Notifications
You must be signed in to change notification settings - Fork 0
/
users_test.go
48 lines (36 loc) · 1.07 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
package gaudius
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestUsers(t *testing.T) {
sdk, err := NewSdk()
require.Nil(t, err)
userID := "1PqKz"
userHandle := "LemonadeJetpack"
user, err := sdk.GetUser(userID)
require.Nil(t, err)
require.EqualValues(t, userHandle, *user.Handle)
user, err = sdk.GetUserByHandle(userHandle)
require.Nil(t, err)
require.EqualValues(t, userID, *user.ID)
aiTracks, err := sdk.GetUserAiAttributed(userHandle, nil)
require.Nil(t, err)
require.Empty(t, aiTracks)
users, err := sdk.UserSearch("LemonadeJetpack")
require.Nil(t, err)
require.EqualValues(t, userID, *users[0].ID)
apps, err := sdk.GetUserAuthorizedApps(userID)
require.Nil(t, err)
require.NotEmpty(t, apps)
tracks, err := sdk.GetUserTracks(*users[0].ID, map[string]string{"limit": "10", "filter_tracks": "all"})
require.Nil(t, err)
require.NotEmpty(t, tracks)
}
func TestFullUsers(t *testing.T) {
sdk, err := NewSdk()
require.Nil(t, err)
topPopUsers, err := sdk.GetTopGenreUsers(Genre.Pop, nil)
require.Nil(t, err)
require.NotEmpty(t, topPopUsers)
}