(t *testing.T)
| 1468 | } |
| 1469 | |
| 1470 | func TestRegisterSessionInactiveTopic(t *testing.T) { |
| 1471 | topicName := "usrMe" |
| 1472 | numUsers := 1 |
| 1473 | helper := TopicTestHelper{} |
| 1474 | helper.setUp(t, numUsers, types.TopicCatMe, topicName, false) |
| 1475 | defer helper.tearDown() |
| 1476 | if len(helper.topic.sessions) != 0 { |
| 1477 | helper.finish() |
| 1478 | t.Fatalf("Initially attached sessions: expected 0 vs found %d", len(helper.topic.sessions)) |
| 1479 | } |
| 1480 | |
| 1481 | uid := helper.uids[0] |
| 1482 | |
| 1483 | s := helper.sessions[0] |
| 1484 | join := &ClientComMessage{ |
| 1485 | Sub: &MsgClientSub{ |
| 1486 | Id: "id456", |
| 1487 | Topic: "me", |
| 1488 | }, |
| 1489 | AsUser: uid.UserId(), |
| 1490 | sess: s, |
| 1491 | } |
| 1492 | |
| 1493 | // Deactivate topic. |
| 1494 | helper.topic.markDeleted() |
| 1495 | |
| 1496 | helper.topic.registerSession(join) |
| 1497 | helper.finish() |
| 1498 | |
| 1499 | // Check for errors from testHubLoop |
| 1500 | if errorMsgs, hasError := helper.hubMessages["__ERROR__"]; hasError { |
| 1501 | t.Fatal(errorMsgs[0].Ctrl.Text) |
| 1502 | } |
| 1503 | |
| 1504 | if len(s.subs) != 0 { |
| 1505 | t.Errorf("Session subscriptions: expected 0, found %d", len(s.subs)) |
| 1506 | } |
| 1507 | online := helper.topic.perUser[uid].online |
| 1508 | if online != 0 { |
| 1509 | t.Errorf("Number of online sessions: expected 0, found %d", online) |
| 1510 | } |
| 1511 | // Session output. |
| 1512 | registerSessionVerifyOutputs(t, helper.results[0], []int{http.StatusServiceUnavailable}) |
| 1513 | // Presence notifications. |
| 1514 | if len(helper.hubMessages) != 0 { |
| 1515 | t.Errorf("Hub isn't expected to receive any messages, received %d", len(helper.hubMessages)) |
| 1516 | } |
| 1517 | } |
| 1518 | |
| 1519 | func TestRegisterSessionUserSpecifiedInSetMessage(t *testing.T) { |
| 1520 | topicName := "grpTest" |
nothing calls this directly
no test coverage detected
searching dependent graphs…