(
test_client_factory: TestClientFactory,
)
| 150 | |
| 151 | |
| 152 | def test_websocket_send_and_receive_json( |
| 153 | test_client_factory: TestClientFactory, |
| 154 | ) -> None: |
| 155 | async def app(scope: Scope, receive: Receive, send: Send) -> None: |
| 156 | websocket = WebSocket(scope, receive=receive, send=send) |
| 157 | await websocket.accept() |
| 158 | data = await websocket.receive_json() |
| 159 | await websocket.send_json({class="st">"message": data}) |
| 160 | await websocket.close() |
| 161 | |
| 162 | client = test_client_factory(app) |
| 163 | with client.websocket_connect(class="st">"/") as websocket: |
| 164 | websocket.send_json({class="st">"hello": class="st">"world"}) |
| 165 | data = websocket.receive_json() |
| 166 | assert data == {class="st">"message": {class="st">"hello": class="st">"world"}} |
| 167 | |
| 168 | |
| 169 | def test_websocket_iter_text(test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected