Handshake fails when the Connection header is invalid.
(self)
| 374 | ) |
| 375 | |
| 376 | def test_invalid_connection(self): |
| 377 | """Handshake fails when the Connection header is invalid.""" |
| 378 | server = ServerProtocol() |
| 379 | request = make_request() |
| 380 | del request.headers["Connection"] |
| 381 | request.headers["Connection"] = "close" |
| 382 | response = server.accept(request) |
| 383 | server.send_response(response) |
| 384 | |
| 385 | self.assertEqual(response.status_code, 426) |
| 386 | self.assertEqual(response.headers["Upgrade"], "websocket") |
| 387 | self.assertHandshakeError( |
| 388 | server, |
| 389 | InvalidUpgrade, |
| 390 | "invalid Connection header: close", |
| 391 | ) |
| 392 | |
| 393 | def test_missing_upgrade(self): |
| 394 | """Handshake fails when the Upgrade header is missing.""" |
nothing calls this directly
no test coverage detected