MCPcopy Index your code
hub / github.com/python-websockets/websockets / test_receive_no_request

Method test_receive_no_request

tests/test_server.py:206–222  ·  view source on GitHub ↗

Server receives no handshake request.

(self)

Source from the content-addressed store, hash-verified

204 self.assertIsNone(server.handshake_exc)
205
206 def test_receive_no_request(self):
207 """Server receives no handshake request."""
208 server = ServerProtocol()
209 server.receive_eof()
210
211 self.assertEqual(server.events_received(), [])
212 self.assertEqual(server.events_received(), [])
213 self.assertIsInstance(server.handshake_exc, InvalidMessage)
214 self.assertEqual(
215 str(server.handshake_exc),
216 "did not receive a valid HTTP request",
217 )
218 self.assertIsInstance(server.handshake_exc.__cause__, EOFError)
219 self.assertEqual(
220 str(server.handshake_exc.__cause__),
221 "connection closed while reading HTTP request line",
222 )
223
224 def test_receive_truncated_request(self):
225 """Server receives a truncated handshake request."""

Callers

nothing calls this directly

Calls 3

ServerProtocolClass · 0.85
events_receivedMethod · 0.80
receive_eofMethod · 0.45

Tested by

no test coverage detected