forked from JeffreyBool/jpush-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cid_test.go
58 lines (47 loc) · 1.06 KB
/
cid_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
package jpush
import (
"context"
"os"
"testing"
)
var cidClient *CIDClient
func TestMain(m *testing.M) {
println("TestMain setup.")
cidClient = NewCIDClient(20, SetAppKey(appKey), SetMasterSecret(masterSecret), SetCIDCount(2))
retCode := m.Run() // 执行测试,包括单元测试、性能测试和示例测试
println("TestMain tear-down.")
os.Exit(retCode)
}
func TestNewCIDClient(t *testing.T) {
NewCIDClient(20,
SetAppKey(appKey),
SetMasterSecret(masterSecret),
SetCIDCount(2), )
}
func TestGetPushID(t *testing.T) {
res, err := cidClient.GetPushID(context.Background())
if err != nil {
t.Error(err)
}
t.Log(res)
}
func TestGetScheduleID(t *testing.T) {
res, err := cidClient.GetScheduleID(context.Background())
if err != nil {
t.Error(err)
}
t.Log(res)
}
func TestNewCIDItem(t *testing.T) {
options := &options{
host: "https://api.jpush.cn",
cidCount: 1000,
appKey:appKey,
masterSecret:masterSecret,
}
res, err := newCIDItem(options, "push", 20).Get(context.Background())
if err != nil {
t.Error(err)
}
t.Log(res)
}