-
Notifications
You must be signed in to change notification settings - Fork 35
/
menu_test.go
92 lines (84 loc) · 1.48 KB
/
menu_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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package weixin
import "testing"
func TestCreateMenu(t *testing.T) {
buttons := []Button{
Button{
Name: "扫码",
SubButton: []Button{
Button{
Name: "扫码带提示",
Type: MenuTypeScancodeWaitmsg,
Key: "rselfmenu_0_0",
},
Button{
Name: "扫码推事件",
Type: MenuTypeScancodePush,
Key: "rselfmenu_0_1",
},
},
},
Button{
Name: "发图",
SubButton: []Button{
Button{
Name: "系统拍照发图",
Type: MenuTypePicSysphoto,
Key: "rselfmenu_1_0",
},
Button{
Name: "拍照或者相册发图",
Type: MenuTypePicPhotoOrAlbum,
Key: "rselfmenu_1_1",
},
Button{
Name: "微信相册发图",
Type: MenuTypePicWeixin,
Key: "rselfmenu_1_2",
},
},
},
Button{
Name: "测试",
SubButton: []Button{
Button{
Name: "腾讯",
Type: MenuTypeView,
URL: "http://qq.com",
},
Button{
Name: "发送位置",
Type: MenuTypeLocationSelect,
Key: "rselfmenu_2_0",
},
},
},
}
err := CreateMenu(buttons)
if err != nil {
t.Error(err)
t.FailNow()
}
}
func TestGetMenu(t *testing.T) {
buttons, err := GetMenu()
if err != nil {
t.Error(err)
t.FailNow()
}
t.Logf("%#v", buttons)
}
func TestDeleteMenu(t *testing.T) {
err := DeleteMenu()
if err != nil {
t.Error(err)
t.FailNow()
}
}
func TestGetMenuInfo(t *testing.T) {
mi, err := GetMenuInfo()
if err != nil {
t.Error(err)
t.FailNow()
}
t.Logf("%v", mi)
}