MCPcopy Create free account
hub / github.com/pallets/quart / test_websocket_accept_connection

Function test_websocket_accept_connection

tests/test_asgi.py:272–290  ·  view source on GitHub ↗
(
    scope: dict, headers: Headers, subprotocol: str | None, has_headers: bool
)

Source from the content-addressed store, hash-verified

270 ],
271)
272async def test_websocket_accept_connection(
273 scope: dict, headers: Headers, subprotocol: str | None, has_headers: bool
274) -> None:
275 connection = ASGIWebsocketConnection(Quart(__name__), scope) # type: ignore
276 mock_send = AsyncMock()
277 await connection.accept_connection(mock_send, headers, subprotocol)
278
279 if has_headers:
280 mock_send.assert_called_with(
281 {
282 "subprotocol": subprotocol,
283 "type": "websocket.accept",
284 "headers": encode_headers(headers),
285 }
286 )
287 else:
288 mock_send.assert_called_with(
289 {"headers": [], "subprotocol": subprotocol, "type": "websocket.accept"}
290 )
291
292
293async def test_websocket_accept_connection_warns(

Callers

nothing calls this directly

Calls 4

accept_connectionMethod · 0.95
QuartClass · 0.90
encode_headersFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…