quart.testing.utils module#
- quart.testing.utils.make_test_body_with_headers(*, data: AnyStr | None = None, form: dict | None = None, files: dict[str, FileStorage] | None = None, json: Any = <object object>, app: Quart | None = None) tuple[bytes, Headers] #
Make the body bytes with associated headers.
- Parameters:
data – Raw data to send in the request body.
form – Key value paired data to send form encoded in the request body.
files – Key FileStorage paired data to send as file encoded in the request body.
json – Data to send json encoded in the request body.
- quart.testing.utils.make_test_headers_path_and_query_string(app: Quart, path: str, headers: dict | Headers | None = None, query_string: dict | None = None, auth: Authorization | tuple[str, str] | None = None, subdomain: str | None = None) tuple[Headers, str, bytes] #
Make the headers and path with defaults for testing.
- Parameters:
app – The application to test against.
path – The path to request. If the query_string argument is not defined this argument will be partitioned on a ‘?’ with the following part being considered the query_string.
headers – Initial headers to send.
query_string – To send as a dictionary, alternatively the query_string can be determined from the path.
- quart.testing.utils.make_test_scope(type_: Literal['http'], path: str, method: str, headers: Headers, query_string: bytes, scheme: str, root_path: str, http_version: str, scope_base: dict | None, *, _preserve_context: bool = False) HTTPScope #
- quart.testing.utils.make_test_scope(type_: Literal['websocket'], path: str, method: str, headers: Headers, query_string: bytes, scheme: str, root_path: str, http_version: str, scope_base: dict | None, *, _preserve_context: bool = False) WebsocketScope
- async quart.testing.utils.no_op_push(path: str, headers: Headers) None #
A push promise sender that does nothing.
This is best used when creating Request instances for testing outside of the QuartClient. The Request instance must know what to do with push promises, and this gives it the option of doing nothing.