-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathyuqueg_test.go
63 lines (57 loc) · 917 Bytes
/
yuqueg_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
package yuqueg_test
import (
"encoding/json"
"os"
"testing"
"github.com/wujiyu115/yuqueg"
)
var (
yu *yuqueg.Service
rst string
l = yuqueg.L
)
func setup() {
yu = yuqueg.NewService("xxx")
yuqueg.SetDebugLevel()
}
func shutdown() {
l.Info(rst)
}
func TestMain(m *testing.M) {
setup()
code := m.Run()
if code == 0 {
shutdown()
}
os.Exit(code)
}
func TestUserGet(t *testing.T) {
d, err := yu.User.Get("")
if err != nil {
t.Log(err)
t.Fail()
return
}
jsonString, _ := json.Marshal(d)
rst = string(jsonString)
}
func TestGroupList(t *testing.T) {
d, err := yu.Group.List("u22579")
if err != nil {
t.Log(err)
t.Fail()
return
}
jsonString, _ := json.Marshal(d)
rst = string(jsonString)
}
func TestDocList(t *testing.T) {
d, err := yu.Doc.List("u22579/xcd0mr")
if err != nil {
t.Log(err)
t.Fail()
return
}
jsonString, _ := json.Marshal(d)
rst = string(jsonString)
}