MCPcopy Create free account
hub / github.com/python-websockets/websockets / test_receive_no_response

Method test_receive_no_response

tests/test_client.py:246–261  ·  view source on GitHub ↗

Client receives no handshake response.

(self, _generate_key)

Source from the content-addressed store, hash-verified

244 )
245
246 def test_receive_no_response(self, _generate_key):
247 """Client receives no handshake response."""
248 client = ClientProtocol(URI)
249 client.receive_eof()
250
251 self.assertEqual(client.events_received(), [])
252 self.assertIsInstance(client.handshake_exc, InvalidMessage)
253 self.assertEqual(
254 str(client.handshake_exc),
255 "did not receive a valid HTTP response",
256 )
257 self.assertIsInstance(client.handshake_exc.__cause__, EOFError)
258 self.assertEqual(
259 str(client.handshake_exc.__cause__),
260 "connection closed while reading HTTP status line",
261 )
262
263 def test_receive_truncated_response(self, _generate_key):
264 """Client receives a truncated handshake response."""

Callers

nothing calls this directly

Calls 3

ClientProtocolClass · 0.85
events_receivedMethod · 0.80
receive_eofMethod · 0.45

Tested by

no test coverage detected