(t *testing.T)
| 382 | } |
| 383 | |
| 384 | func TestDispatchLeaveUnsubMe(t *testing.T) { |
| 385 | uid := types.Uid(1) |
| 386 | s := test_makeSession(uid) |
| 387 | wg := sync.WaitGroup{} |
| 388 | r := responses{} |
| 389 | wg.Add(1) |
| 390 | go s.testWriteLoop(&r, &wg) |
| 391 | |
| 392 | s.subs = make(map[string]*Subscription) |
| 393 | s.subs[uid.UserId()] = &Subscription{} |
| 394 | |
| 395 | msg := &ClientComMessage{ |
| 396 | Leave: &MsgClientLeave{ |
| 397 | Id: "123", |
| 398 | // Cannot unsubscribe from 'me'. |
| 399 | Topic: "me", |
| 400 | Unsub: true, |
| 401 | }, |
| 402 | } |
| 403 | |
| 404 | s.dispatch(msg) |
| 405 | close(s.send) |
| 406 | wg.Wait() |
| 407 | |
| 408 | verifyResponseCodes(&r, []int{http.StatusForbidden}, t) |
| 409 | } |
| 410 | |
| 411 | func TestDispatchLeaveUnknownTopic(t *testing.T) { |
| 412 | uid := types.Uid(1) |
nothing calls this directly
no test coverage detected
searching dependent graphs…