-
Notifications
You must be signed in to change notification settings - Fork 1
/
mipush_test.go
64 lines (55 loc) · 1.18 KB
/
mipush_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
package push
import (
"fmt"
"os"
"strconv"
"testing"
"time"
"github.com/buger/jsonparser"
)
func TestSend(t *testing.T) {
for _, v := range os.Environ() {
// 输出系统所有环境变量的值
fmt.Println(v)
t.Log("os env", v)
}
}
func TestSendMessage(t *testing.T) {
timeStart := time.Now().UnixNano()
fmt.Println("timeStart ", timeStart)
for i := 0; i < 50; i++ {
fileName := "MiPush" + strconv.Itoa(i%2)
fmt.Println(fileName)
}
endTime := time.Now().UnixNano()
fmt.Println("endTime ", endTime)
fmt.Println("end - start time :", endTime-timeStart)
fmt.Println(os.Getenv("MI_PUSH_LOGGING_MODE"))
t.Log("timeStart ", timeStart)
}
func TestToken(t *testing.T) {
data := []byte(`{
"person": {
"name": {
"first": "Leonid",
"last": "Bugaev",
"fullName": "Leonid Bugaev"
},
"github": {
"handle": "buger",
"followers": 109
},
"avatars": [
{
"url": "https://avatars1.githubusercontent.com/u/14009?v=3&s=460",
"type": "thumbnail"
}
]
},
"company": {
"name": "Acme"
}
}`)
// You can specify key path by providing arguments to Get function
t.Log(jsonparser.Get(data, "person", "name", "fullName"))
}