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

Method test_origin

tests/test_server.py:539–548  ·  view source on GitHub ↗

Handshake succeeds when checking origin.

(self)

Source from the content-addressed store, hash-verified

537 )
538
539 def test_origin(self):
540 """Handshake succeeds when checking origin."""
541 server = ServerProtocol(origins=["https://example.com"])
542 request = make_request()
543 request.headers["Origin"] = "https://example.com"
544 response = server.accept(request)
545 server.send_response(response)
546
547 self.assertHandshakeSuccess(server)
548 self.assertEqual(server.origin, "https://example.com")
549
550 def test_no_origin(self):
551 """Handshake fails when checking origin and the Origin header is missing."""

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