-
Notifications
You must be signed in to change notification settings - Fork 0
/
qqmusic_test.go
65 lines (58 loc) · 1.32 KB
/
qqmusic_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
54
55
56
57
58
59
60
61
62
63
64
65
package qqmusic
import (
"os"
"testing"
)
func getCookie() string {
return os.Getenv("QQMUSIC_COOKIE")
}
func TestSearchSinger(t *testing.T) {
cookie := getCookie()
if cookie == "" {
t.Skip()
}
singerInfo, err := New(cookie).SearchSinger("美波")
if err != nil || singerInfo == nil {
t.Error(err, singerInfo)
}
}
func TestGetSingerFansNum(t *testing.T) {
cookie := getCookie()
if cookie == "" {
t.Skip()
}
count, err := New(cookie).GetSingerFansCount("003fA5G40k6hKc")
if err != nil || count == 0 {
t.Error(err, count)
}
}
func TestGetSonglistBySinger(t *testing.T) {
cookie := getCookie()
if cookie == "" {
t.Skip()
}
totalNum, songInfos, err := New(cookie).GetSonglistBySinger("003fA5G40k6hKc", 1, 2)
if err != nil || len(songInfos) == 0 || totalNum == 0 {
t.Error(err, songInfos, totalNum)
}
}
func TestGetSongCommentCount(t *testing.T) {
cookie := getCookie()
if cookie == "" {
t.Skip()
}
countMap, err := New(cookie).GetSongCommentCount([]int{311084300, 203650936})
if err != nil || len(countMap) == 0 {
t.Error(err, countMap)
}
}
func TestGetSongFavorCount(t *testing.T) {
cookie := getCookie()
if cookie == "" {
t.Skip()
}
countMap, err := New(cookie).GetSongFavorCount([]string{"004Q9vXu2FuqDs", "0045YdtG4FSRLN"})
if err != nil || len(countMap) == 0 {
t.Error(err, countMap)
}
}