-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathhttp_client_test.go
57 lines (48 loc) · 1.03 KB
/
http_client_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
package umeng_test
import (
"testing"
"github.com/busyfree/go-umeng"
)
var data *umeng.Data
func init() {
data = umeng.NewData(umeng.AppAndroid)
}
func TestStatus(t *testing.T) {
resp := data.Status()
if len(resp.Code) > 0 {
t.Log("data.Status 测试通过")
} else {
t.Error("data.Status 测试不通过")
}
}
func TestCancel(t *testing.T) {
resp := data.Cancel()
if len(resp.Code) > 0 {
t.Log("data.Cancel 测试通过")
} else {
t.Error("data.Cancel 测试不通过")
}
}
func TestUpload(t *testing.T) {
resp := data.Upload()
if len(resp.Code) > 0 {
t.Log("data.Upload 测试通过")
} else {
t.Error("data.Upload 测试不通过")
}
}
func TestPush(t *testing.T) {
body := umeng.AndroidBody{}
body.DisplayType = "message"
body.Custom = "test"
body.Title = "1212"
extra := make(map[string]string, 0)
extra["key1"] = "1212x"
extra["key2"] = "12123323"
resp := data.Push(body, nil, nil, extra)
if len(resp.Code) > 0 {
t.Log("data.Push 测试通过")
} else {
t.Error("data.Push 测试不通过")
}
}