MCPcopy
hub / github.com/eatmoreapple/openwechat / TestLogout

Function TestLogout

bot_test.go:19–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17}
18
19func TestLogout(t *testing.T) {
20 bot := DefaultBot(Desktop)
21 bot.LoginCallBack = func(body CheckLoginResponse) {
22 t.Log("login")
23 }
24 bot.LogoutCallBack = func(bot *Bot) {
25 t.Log("logout")
26 }
27 bot.MessageHandler = func(msg *Message) {
28 if msg.IsText() && msg.Content == "logout" {
29 if err := bot.Logout(); err != nil {
30 t.Error(err)
31 }
32 }
33 }
34 if err := bot.Login(); err != nil {
35 t.Error(err)
36 return
37 }
38 _ = bot.Block()
39}
40
41func TestMessageHandle(t *testing.T) {
42 bot := DefaultBot(Desktop)

Callers

nothing calls this directly

Calls 6

DefaultBotFunction · 0.85
IsTextMethod · 0.80
ErrorMethod · 0.80
BlockMethod · 0.80
LoginMethod · 0.65
LogoutMethod · 0.45

Tested by

no test coverage detected