Replies: 1 comment
-
What's exactly is your problem? You can find out some TestClient usage examples in Starlette's test suite - https://github.com/encode/starlette/blob/master/tests/test_websockets.py#L117 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, WebSocketTestSession misses async methods, which is crucial for many test cases, because, in contrast to mostly idempotent HTTP requests and their linear tests, WebSockets are mostly used in async, concurrent environment, when you don't know and cannot rely on specific order nor number of responses.
This was already asked on the internet, e.g: GitHub: FastAPI Issues, Reddit: FastAPI.
I needed this feature for a project of mine, so I made a short standalone solution:
https://gist.github.com/AivanF/4616d7e89fb5ea497deda31201db2c60
And I made a commit to forked Starlette to show how it can look like upon integration: b9a3de6
If the community likes the idea, I'll make a proper Pull Request with tests to cover the added code.
Beta Was this translation helpful? Give feedback.
All reactions