# quart.testing.client module

class quart.testing.client.QuartClient(app, use_cookies=True)

  Bases: `object`

  Parameters:

    - app (Quart)

    - use_cookies (bool)

  http_connection_class

    alias of `TestHTTPConnection`

  websocket_connection_class

    alias of `TestWebsocketConnection`

  async open(path, *, method='GET', headers=None, data=None, form=None, files=None, query_string=None, json=sentinel, scheme='http', follow_redirects=False, root_path='', http_version='1.1', scope_base=None, auth=None, subdomain=None)
    Parameters:

      - path (str)

      - method (str)

      - headers (dict | Headers | None)

      - data (AnyStr | None)

      - form (dict | None)

      - files (dict[str, FileStorage] | None)

      - query_string (dict | None)

      - json (Any)

      - scheme (str)

      - follow_redirects (bool)

      - root_path (str)

      - http_version (str)

      - scope_base (dict | None)

      - auth (Authorization | tuple[str, str] | None)

      - subdomain (str | None)

    Return type:

      Response

  request(path, *, method='GET', headers=None, query_string=None, scheme='http', root_path='', http_version='1.1', scope_base=None, auth=None, subdomain=None)
    Parameters:

      - path (str)

      - method (str)

      - headers (dict | Headers | None)

      - query_string (dict | None)

      - scheme (str)

      - root_path (str)

      - http_version (str)

      - scope_base (dict | None)

      - auth (Authorization | tuple[str, str] | None)

      - subdomain (str | None)

    Return type:

      TestHTTPConnectionProtocol

  websocket(path, *, headers=None, query_string=None, scheme='ws', subprotocols=None, root_path='', http_version='1.1', scope_base=None, auth=None, subdomain=None)
    Parameters:

      - path (str)

      - headers (dict | Headers | None)

      - query_string (dict | None)

      - scheme (str)

      - subprotocols (list[str] | None)

      - root_path (str)

      - http_version (str)

      - scope_base (dict | None)

      - auth (Authorization | tuple[str, str] | None)

      - subdomain (str | None)

    Return type:

      TestWebsocketConnectionProtocol

  async delete(*args, **kwargs)

    Make a DELETE request.

    See `open()` for argument details.

    Parameters:

      - args (Any)

      - kwargs (Any)

    Return type:

      Response

  async get(*args, **kwargs)

    Make a GET request.

    See `open()` for argument details.

    Parameters:

      - args (Any)

      - kwargs (Any)

    Return type:

      Response

  async head(*args, **kwargs)

    Make a HEAD request.

    See `open()` for argument details.

    Parameters:

      - args (Any)

      - kwargs (Any)

    Return type:

      Response

  async options(*args, **kwargs)

    Make a OPTIONS request.

    See `open()` for argument details.

    Parameters:

      - args (Any)

      - kwargs (Any)

    Return type:

      Response

  async patch(*args, **kwargs)

    Make a PATCH request.

    See `open()` for argument details.

    Parameters:

      - args (Any)

      - kwargs (Any)

    Return type:

      Response

  async post(*args, **kwargs)

    Make a POST request.

    See `open()` for argument details.

    Parameters:

      - args (Any)

      - kwargs (Any)

    Return type:

      Response

  async put(*args, **kwargs)

    Make a PUT request.

    See `open()` for argument details.

    Parameters:

      - args (Any)

      - kwargs (Any)

    Return type:

      Response

  async trace(*args, **kwargs)

    Make a TRACE request.

    See `open()` for argument details.

    Parameters:

      - args (Any)

      - kwargs (Any)

    Return type:

      Response

  set_cookie(server_name, key, value='', max_age=None, expires=None, path='/', domain=None, secure=False, httponly=False, samesite=None)

    Set a cookie in the cookie jar.

    The arguments are the standard cookie morsels and this is a wrapper around the stdlib SimpleCookie code.

    Parameters:

      - server_name (str)

      - key (str)

      - value (str)

      - max_age (int | timedelta | None)

      - expires (int | float | datetime | None)

      - path (str)

      - domain (str | None)

      - secure (bool)

      - httponly (bool)

      - samesite (str)

    Return type:

      None

  delete_cookie(server_name, key, path='/', domain=None)

    Delete a cookie (set to expire immediately).

    Parameters:

      - server_name (str)

      - key (str)

      - path (str)

      - domain (str | None)

    Return type:

      None

  session_transaction(path='/', *, method='GET', headers=None, query_string=None, scheme='http', data=None, form=None, json=sentinel, root_path='', http_version='1.1', auth=None)
    Parameters:

      - path (str)

      - method (str)

      - headers (dict | Headers | None)

      - query_string (dict | None)

      - scheme (str)

      - data (AnyStr | None)

      - form (dict | None)

      - json (Any)

      - root_path (str)

      - http_version (str)

      - auth (Authorization | tuple[str, str] | None)

    Return type:

      AsyncGenerator[SessionMixin, None]