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

Method test_supported_origin

tests/test_server.py:599–610  ·  view source on GitHub ↗

Handshake succeeds when checking origins and the origin is supported.

(self)

Source from the content-addressed store, hash-verified

597 )
598
599 def test_supported_origin(self):
600 """Handshake succeeds when checking origins and the origin is supported."""
601 server = ServerProtocol(
602 origins=["https://example.com", "https://other.example.com"]
603 )
604 request = make_request()
605 request.headers["Origin"] = "https://other.example.com"
606 response = server.accept(request)
607 server.send_response(response)
608
609 self.assertHandshakeSuccess(server)
610 self.assertEqual(server.origin, "https://other.example.com")
611
612 def test_unsupported_origin(self):
613 """Handshake fails when checking origins and the origin is unsupported."""

Callers

nothing calls this directly

Calls 5

acceptMethod · 0.95
send_responseMethod · 0.95
ServerProtocolClass · 0.85
make_requestFunction · 0.85

Tested by

no test coverage detected