(test_client_factory: TestClientFactory)
| 281 | |
| 282 | |
| 283 | def test_application_close(test_client_factory: TestClientFactory) -> None: |
| 284 | async def app(scope: Scope, receive: Receive, send: Send) -> None: |
| 285 | websocket = WebSocket(scope, receive=receive, send=send) |
| 286 | await websocket.accept() |
| 287 | await websocket.close(status.WS_1001_GOING_AWAY) |
| 288 | |
| 289 | client = test_client_factory(app) |
| 290 | with client.websocket_connect(class="st">"/") as websocket: |
| 291 | with pytest.raises(WebSocketDisconnect) as exc: |
| 292 | websocket.receive_text() |
| 293 | assert exc.value.code == status.WS_1001_GOING_AWAY |
| 294 | |
| 295 | |
| 296 | def test_rejected_connection(test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected