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

Method test_enable_subprotocol

tests/test_client.py:592–599  ·  view source on GitHub ↗

Client offers a subprotocol and the server enables it.

(self)

Source from the content-addressed store, hash-verified

590 self.assertEqual(request.headers["Sec-WebSocket-Protocol"], "chat")
591
592 def test_enable_subprotocol(self):
593 """Client offers a subprotocol and the server enables it."""
594 client = ClientProtocol(URI, subprotocols=["chat"])
595 with alter_and_receive_response(client) as response:
596 response.headers["Sec-WebSocket-Protocol"] = "chat"
597
598 self.assertHandshakeSuccess(client)
599 self.assertEqual(client.subprotocol, "chat")
600
601 def test_no_subprotocol_accepted(self):
602 """Client offers a subprotocol, but the server doesn't enable it."""

Callers

nothing calls this directly

Calls 3

ClientProtocolClass · 0.85

Tested by

no test coverage detected