Server receives a handshake request.
(self, _formatdate)
| 49 | """Test basic opening handshake scenarios.""" |
| 50 | |
| 51 | def test_receive_request(self, _formatdate): |
| 52 | """Server receives a handshake request.""" |
| 53 | server = ServerProtocol() |
| 54 | server.receive_data( |
| 55 | ( |
| 56 | f"GET /test HTTP/1.1\r\n" |
| 57 | f"Host: example.com\r\n" |
| 58 | f"Upgrade: websocket\r\n" |
| 59 | f"Connection: Upgrade\r\n" |
| 60 | f"Sec-WebSocket-Key: {KEY}\r\n" |
| 61 | f"Sec-WebSocket-Version: 13\r\n" |
| 62 | f"\r\n" |
| 63 | ).encode(), |
| 64 | ) |
| 65 | |
| 66 | self.assertEqual(server.data_to_send(), []) |
| 67 | self.assertFalse(server.close_expected()) |
| 68 | self.assertEqual(server.state, CONNECTING) |
| 69 | |
| 70 | def test_accept_and_send_successful_response(self, _formatdate): |
| 71 | """Server accepts a handshake request and sends a successful response.""" |
nothing calls this directly
no test coverage detected