MCPcopy Create free account
hub / github.com/dearcode/candy / TestAddFriend

Function TestAddFriend

client/candy_test.go:232–263  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

230}
231
232func TestAddFriend(t *testing.T) {
233 relation := make(map[int64]int64)
234 for name := range userNames {
235 id, err := client.Login(name, passwd[name])
236 if err != nil {
237 t.Fatalf("Login error:%v", err)
238 }
239
240 for _, uid := range userNames {
241 if uid == id {
242 //自己不能添加自己
243 continue
244 }
245 //add friend
246 confirm := false
247 if _, ok := relation[uid]; ok {
248 confirm = true
249 }
250 ok, err := client.AddFriend(uid, confirm, "ok")
251 if err != nil {
252 t.Fatalf("AddFriend error:%v", err)
253 }
254 // 如果双方都加过好友,这里ok应该返回true
255 if relation[uid] == id {
256 if !ok {
257 t.Fatal("expect ok is true")
258 }
259 }
260 relation[id] = uid
261 }
262 }
263}
264
265func TestFileUploadAndDownload(t *testing.T) {
266 keys := make(map[string]struct{})

Callers

nothing calls this directly

Calls 1

LoginMethod · 0.65

Tested by

no test coverage detected