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

Method test_invalid_accept

tests/test_client.py:425–436  ·  view source on GitHub ↗

Handshake fails when the Sec-WebSocket-Accept header is invalid.

(self)

Source from the content-addressed store, hash-verified

423 )
424
425 def test_invalid_accept(self):
426 """Handshake fails when the Sec-WebSocket-Accept header is invalid."""
427 client = ClientProtocol(URI)
428 with alter_and_receive_response(client) as response:
429 del response.headers["Sec-WebSocket-Accept"]
430 response.headers["Sec-WebSocket-Accept"] = ACCEPT
431
432 self.assertHandshakeError(
433 client,
434 InvalidHeader,
435 f"invalid Sec-WebSocket-Accept header: {ACCEPT}",
436 )
437
438 def test_no_extensions(self):
439 """Handshake succeeds without extensions."""

Callers

nothing calls this directly

Calls 3

assertHandshakeErrorMethod · 0.95
ClientProtocolClass · 0.85

Tested by

no test coverage detected