(test_client_factory: TestClientFactory)
| 629 | |
| 630 | |
| 631 | def test_receive_before_accept(test_client_factory: TestClientFactory) -> None: |
| 632 | async def app(scope: Scope, receive: Receive, send: Send) -> None: |
| 633 | websocket = WebSocket(scope, receive=receive, send=send) |
| 634 | await websocket.accept() |
| 635 | websocket.client_state = WebSocketState.CONNECTING |
| 636 | await websocket.receive() |
| 637 | |
| 638 | client = test_client_factory(app) |
| 639 | with pytest.raises(RuntimeError): |
| 640 | with client.websocket_connect(class="st">"/") as websocket: |
| 641 | websocket.send({class="st">"type": class="st">"websocket.send"}) |
| 642 | |
| 643 | |
| 644 | def test_receive_wrong_message_type(test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected