async-asgi-testclient
async-asgi-testclient copied to clipboard
A framework-agnostic library for testing ASGI web applications
Fixes #54 - Test classes can now receive the early termination event as a raised Exception where the body of the exception is the closure message (incase validation is wanted...
In the scenario where a websocket connection is closed before being accepted by the server, the WebSocketSession currently throws an `AssertionError` due to the received message not being type `"websocket.accept"`...
when starlette returns a redirect response (such as when attempting to fix trailing slashes), it returns an absolute path, but async-asgi-testclient always interprets it as a relative path. I propose...
WIP: test suite for ASGI specification compliance. It seems like a great idea for a ASGI test library to have tests itself to check it is compliant with the spec,...
This package currently treats lifespan protocol as mandatory - if the application raises an exception in a lifespan.startup message, it treats the testclient as failed. The [ASGI spec states](https://asgi.readthedocs.io/en/latest/specs/lifespan.html#scope): >...
I'm testing an app that needs to know whether a WebSocket connection was done over `ws://` or `wss://`. Currently, while I can override the scheme for HTTP requests, I cannot...
I am testing a FastAPI application that actually cares about the request hostname and port. I find async-asgi-testclient much better for our needs than Starlette's TestClient or httpx, however, right...
Fixes same as https://github.com/vinissimus/async-asgi-testclient/pull/42
https://asgi.readthedocs.io/en/latest/specs/www.html#websocket-connection-scope "subprotocols" key should be built from Sec-WebSocket-Protocol header value. Currently it's always empty. ``` scope = { "type": "websocket", "headers": flatten_headers(headers), "path": path, "query_string": query_string_bytes, "root_path": "", "scheme": "http",...
Allow using a tuple for `files` argument to pass few files with the same name. This is required to test these endpoints https://fastapi.tiangolo.com/tutorial/request-files/#multiple-file-uploads Example for `requests` module: https://stackoverflow.com/a/20769921