(t *testing.T)
| 1570 | } |
| 1571 | |
| 1572 | func TestRegisterSessionInvalidWantStrInSetMessage(t *testing.T) { |
| 1573 | topicName := "grpTest" |
| 1574 | numUsers := 1 |
| 1575 | helper := TopicTestHelper{} |
| 1576 | helper.setUp(t, numUsers, types.TopicCatGrp, topicName, false) |
| 1577 | defer helper.tearDown() |
| 1578 | if len(helper.topic.sessions) != 0 { |
| 1579 | helper.finish() |
| 1580 | t.Fatalf("Initially attached sessions: expected 0 vs found %d", len(helper.topic.sessions)) |
| 1581 | } |
| 1582 | |
| 1583 | uid := helper.uids[0] |
| 1584 | |
| 1585 | s := helper.sessions[0] |
| 1586 | join := &ClientComMessage{ |
| 1587 | Original: topicName, |
| 1588 | Sub: &MsgClientSub{ |
| 1589 | Id: "id456", |
| 1590 | Topic: topicName, |
| 1591 | Set: &MsgSetQuery{ |
| 1592 | Sub: &MsgSetSub{ |
| 1593 | // Specify the user. This should result in an error. |
| 1594 | Mode: "Invalid mode string", |
| 1595 | }, |
| 1596 | }, |
| 1597 | }, |
| 1598 | AsUser: uid.UserId(), |
| 1599 | sess: s, |
| 1600 | } |
| 1601 | |
| 1602 | helper.topic.registerSession(join) |
| 1603 | helper.finish() |
| 1604 | |
| 1605 | // Check for errors from testHubLoop |
| 1606 | if errorMsgs, hasError := helper.hubMessages["__ERROR__"]; hasError { |
| 1607 | t.Fatal(errorMsgs[0].Ctrl.Text) |
| 1608 | } |
| 1609 | |
| 1610 | if len(s.subs) != 0 { |
| 1611 | t.Errorf("Session subscriptions: expected 0, found %d", len(s.subs)) |
| 1612 | } |
| 1613 | online := helper.topic.perUser[uid].online |
| 1614 | if online != 0 { |
| 1615 | t.Errorf("Number of online sessions: expected 0, found %d", online) |
| 1616 | } |
| 1617 | // Session output. |
| 1618 | registerSessionVerifyOutputs(t, helper.results[0], []int{http.StatusBadRequest}) |
| 1619 | // Presence notifications. |
| 1620 | if len(helper.hubMessages) != 0 { |
| 1621 | t.Errorf("Hub isn't expected to receive any messages, received %d", len(helper.hubMessages)) |
| 1622 | } |
| 1623 | } |
| 1624 | |
| 1625 | func TestRegisterSessionMaxSubscriberCountExceeded(t *testing.T) { |
| 1626 | topicName := "grpTest" |
nothing calls this directly
no test coverage detected
searching dependent graphs…