quart.testing.client 模块#
- class quart.testing.client.QuartClient(app: Quart, use_cookies: bool = True)#
基类:
object
- delete_cookie(server_name: str, key: str, path: str = '/', domain: str | None = None) None #
删除 cookie(设置为立即过期)。
- http_connection_class#
- async open(path: str, *, method: str = 'GET', headers: dict | ~werkzeug.datastructures.headers.Headers | None = None, data: AnyStr | None = None, form: dict | None = None, files: dict[str, ~quart.datastructures.FileStorage] | None = None, query_string: dict | None = None, json: ~typing.Any = <object object>, scheme: str = 'http', follow_redirects: bool = False, root_path: str = '', http_version: str = '1.1', scope_base: dict | None = None, auth: ~werkzeug.datastructures.auth.Authorization | tuple[str, str] | None = None, subdomain: str | None = None) Response #
- request(path: str, *, method: str = 'GET', headers: dict | Headers | None = None, query_string: dict | None = None, scheme: str = 'http', root_path: str = '', http_version: str = '1.1', scope_base: dict | None = None, auth: Authorization | tuple[str, str] | None = None, subdomain: str | None = None) TestHTTPConnectionProtocol #
- session_transaction(path: str = '/', *, method: str = 'GET', headers: dict | ~werkzeug.datastructures.headers.Headers | None = None, query_string: dict | None = None, scheme: str = 'http', data: AnyStr | None = None, form: dict | None = None, json: ~typing.Any = <object object>, root_path: str = '', http_version: str = '1.1', auth: ~werkzeug.datastructures.auth.Authorization | tuple[str, str] | None = None) AsyncGenerator[SessionMixin, None] #
- set_cookie(server_name: str, key: str, value: str = '', max_age: int | timedelta | None = None, expires: int | float | datetime | None = None, path: str = '/', domain: str | None = None, secure: bool = False, httponly: bool = False, samesite: str = None) None #
在 cookie 罐中设置 cookie。
参数是标准 cookie 小片段,这是对 stdlib SimpleCookie 代码的包装器。
- websocket(path: str, *, headers: dict | Headers | None = None, query_string: dict | None = None, scheme: str = 'ws', subprotocols: list[str] | None = None, root_path: str = '', http_version: str = '1.1', scope_base: dict | None = None, auth: Authorization | tuple[str, str] | None = None, subdomain: str | None = None) TestWebsocketConnectionProtocol #
- websocket_connection_class#
alias of
TestWebsocketConnection