(test_client_factory: TestClientFactory)
| 103 | |
| 104 | |
| 105 | def test_websocket_port(test_client_factory: TestClientFactory) -> None: |
| 106 | async def app(scope: Scope, receive: Receive, send: Send) -> None: |
| 107 | websocket = WebSocket(scope, receive=receive, send=send) |
| 108 | await websocket.accept() |
| 109 | await websocket.send_json({class="st">"port": websocket.url.port}) |
| 110 | await websocket.close() |
| 111 | |
| 112 | client = test_client_factory(app) |
| 113 | with client.websocket_connect(class="st">"ws://example.com:123/123?a=abc") as websocket: |
| 114 | data = websocket.receive_json() |
| 115 | assert data == {class="st">"port": 123} |
| 116 | |
| 117 | |
| 118 | def test_websocket_send_and_receive_text( |
nothing calls this directly
no test coverage detected