-
Notifications
You must be signed in to change notification settings - Fork 0
/
weixin_handler_test.go
81 lines (70 loc) · 1.82 KB
/
weixin_handler_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
package delayed_job
import (
"flag"
"testing"
)
var (
weixin_corp_server_url = flag.String("weixin_corp_server_url", "", "")
weixin_corp_id = flag.String("weixin_corp_id", "", "")
weixin_corp_secret = flag.String("weixin_corp_secret", "", "")
weixin_target_type = flag.String("weixin_target_type", "user", "")
weixin_targets = flag.String("weixin_targets", "", "")
weixin_agent_id = flag.String("weixin_agent_id", "1", "")
)
func TestWeixinHandler(t *testing.T) {
if "" == *weixin_corp_id {
t.Skip("weixin is skipped.")
}
handler, e := newWeixinHandler(nil, map[string]interface{}{"type": "weixin_command",
"corp_server_url": *weixin_corp_server_url,
"corp_id": *weixin_corp_id,
"corp_secret": *weixin_corp_secret,
"target_type": *weixin_target_type,
"targets": *weixin_targets,
"content": "this is test message.这是一个测试消息。",
"agent_id": *weixin_agent_id})
if nil != e {
t.Error(e)
// if e.Error() != test.excepted_error {
// t.Error(e)
// }
return
}
e = handler.Perform()
if nil != e {
t.Error(e)
// if e.Error() != test.excepted_error {
// t.Error(e)
// }
return
}
}
// func TestRunWeixin(t *testing.T) {
// t.Skip("===")
// e := Main(":0", "backend")
// if nil != e {
// t.Error(e)
// return
// }
// w, e := newWorker(map[string]interface{}{})
// if nil != e {
// t.Error(e)
// return
// }
// defer w.innerClose()
// w.start()
// defer w.Close()
// func(w *worker, backend *dbBackend) {
// e := backend.enqueue(1, 0, 1, "aa", time.Time{}, map[string]interface{}{"type": "test"})
// if nil != e {
// t.Error(e)
// return
// }
// select {
// case <-test_chan:
// return
// case <-time.After(2 * time.Second):
// t.Error("not recv")
// }
// }(w, w.backend)
// }