(
scope: dict, headers: Headers, subprotocol: str | None, has_headers: bool
)
| 270 | ], |
| 271 | ) |
| 272 | async 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 | |
| 293 | async def test_websocket_accept_connection_warns( |
nothing calls this directly
no test coverage detected
searching dependent graphs…