(t *testing.T)
| 1347 | } |
| 1348 | |
| 1349 | func TestReplyGetDescInvalidOpts(t *testing.T) { |
| 1350 | numUsers := 1 |
| 1351 | helper := TopicTestHelper{} |
| 1352 | helper.setUp(t, numUsers, types.TopicCatMe, "" /*attach=*/, true) |
| 1353 | defer helper.tearDown() |
| 1354 | |
| 1355 | msg := ClientComMessage{ |
| 1356 | Original: "dummy", |
| 1357 | } |
| 1358 | // Can't specify User in opts. |
| 1359 | if err := helper.topic.replyGetDesc(helper.sessions[0], 123, false, &MsgGetOpts{User: "abcdef"}, &msg); err == nil { |
| 1360 | t.Error("replyGetDesc expected to error out.") |
| 1361 | } else if err.Error() != "invalid GetDesc query" { |
| 1362 | t.Errorf("Unexpected error: expected 'invalid GetDesc query', got '%s'", err.Error()) |
| 1363 | } |
| 1364 | helper.finish() |
| 1365 | |
| 1366 | // Check for errors from testHubLoop |
| 1367 | if errorMsgs, hasError := helper.hubMessages["__ERROR__"]; hasError { |
| 1368 | t.Fatal(errorMsgs[0].Ctrl.Text) |
| 1369 | } |
| 1370 | |
| 1371 | if len(helper.results[0].messages) != 1 { |
| 1372 | t.Fatalf("`responses` expected to contain 1 element, found %d", len(helper.results[0].messages)) |
| 1373 | } |
| 1374 | resp := helper.results[0].messages[0].(*ServerComMessage) |
| 1375 | if resp.Ctrl == nil { |
| 1376 | t.Fatalf("response expected to contain a Ctrl message") |
| 1377 | } |
| 1378 | if resp.Ctrl.Code != 400 { |
| 1379 | t.Errorf("response code: expected 400, found: %d", resp.Ctrl.Code) |
| 1380 | } |
| 1381 | // Presence notifications. |
| 1382 | if len(helper.hubMessages) != 0 { |
| 1383 | t.Errorf("Hub isn't expected to receive any messages, received %d", len(helper.hubMessages)) |
| 1384 | } |
| 1385 | } |
| 1386 | |
| 1387 | // Verifies ctrl codes in session outputs. |
| 1388 | func registerSessionVerifyOutputs(t *testing.T, sessionOutput *responses, expectedCtrlCodes []int) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…