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

Function TestPinUser

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

Source from the content-addressed store, hash-verified

93}
94
95func TestPinUser(t *testing.T) {
96 bot := DefaultBot(Desktop)
97 if err := bot.Login(); err != nil {
98 t.Error(err)
99 return
100 }
101 user, err := bot.GetCurrentUser()
102 if err != nil {
103 t.Error(err)
104 return
105 }
106 friends, err := user.Friends()
107 if err != nil {
108 t.Error(err)
109 return
110 }
111 if friends.Count() > 0 {
112 f := friends.First()
113 if err = f.Pin(); err != nil {
114 t.Error(err)
115 return
116 }
117 time.Sleep(time.Second * 5)
118 if err = f.UnPin(); err != nil {
119 t.Error(err)
120 return
121 }
122 }
123}
124
125func TestSender(t *testing.T) {
126 bot := DefaultBot(Desktop)

Callers

nothing calls this directly

Calls 9

DefaultBotFunction · 0.85
ErrorMethod · 0.80
GetCurrentUserMethod · 0.80
PinMethod · 0.80
UnPinMethod · 0.80
LoginMethod · 0.65
FriendsMethod · 0.45
CountMethod · 0.45
FirstMethod · 0.45

Tested by

no test coverage detected