(
test_client_factory: TestClientFactory,
)
| 44 | |
| 45 | |
| 46 | def test_websocket_ensure_unicode_on_send_json( |
| 47 | test_client_factory: TestClientFactory, |
| 48 | ) -> None: |
| 49 | async def app(scope: Scope, receive: Receive, send: Send) -> None: |
| 50 | websocket = WebSocket(scope, receive=receive, send=send) |
| 51 | |
| 52 | await websocket.accept() |
| 53 | message = await websocket.receive_json(mode="text") |
| 54 | await websocket.send_json(message, mode="text") |
| 55 | await websocket.close() |
| 56 | |
| 57 | client = test_client_factory(app) |
| 58 | with client.websocket_connect("/123?a=abc") as websocket: |
| 59 | websocket.send_json({"test": "数据"}, mode="text") |
| 60 | data = websocket.receive_text() |
| 61 | assert data == '{"test":"数据"}' |
| 62 | |
| 63 | |
| 64 | def test_websocket_query_params(test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected