class documentation

class FlaskClient(Client): (source)

View In Hierarchy

Works like a regular Werkzeug test client but has knowledge about Flask's contexts to defer the cleanup of the request context until the end of a ``with`` block. For general information about how to use this class refer to :class:`werkzeug.test.Client`. .. versionchanged:: 0.12 `app.test_client()` includes preset default environment, which can be set after instantiation of the `app.test_client()` object in `client.environ_base`. Basic usage is outlined in the :doc:`/testing` chapter.

Method __enter__ Undocumented
Method __exit__ Undocumented
Method __init__ Undocumented
Method open Undocumented
Method session_transaction When used in combination with a ``with`` statement this opens a session transaction. This can be used to modify the session that the test client uses. Once the ``with`` block is left the session is stored back.
Class Variable application Undocumented
Instance Variable environ_base Undocumented
Instance Variable preserve_context Undocumented
Method _copy_environ Undocumented
Method _request_from_builder_args Undocumented
Instance Variable _context_stack Undocumented
Instance Variable _new_contexts Undocumented
def __enter__(self) -> FlaskClient: (source)

Undocumented

def __exit__(self, exc_type: t.Optional[type], exc_value: t.Optional[BaseException], tb: t.Optional[TracebackType]): (source)

Undocumented

def __init__(self, *args: t.Any, **kwargs: t.Any): (source)

Undocumented

def open(self, *args: t.Any, buffered: bool = False, follow_redirects: bool = False, **kwargs: t.Any) -> TestResponse: (source)

Undocumented

@contextmanager
def session_transaction(self, *args: t.Any, **kwargs: t.Any) -> t.Generator[SessionMixin, None, None]: (source)

When used in combination with a ``with`` statement this opens a session transaction. This can be used to modify the session that the test client uses. Once the ``with`` block is left the session is stored back. :: with client.session_transaction() as session: session['value'] = 42 Internally this is implemented by going through a temporary test request context and since session handling could depend on request variables this function accepts the same arguments as :meth:`~flask.Flask.test_request_context` which are directly passed through.

application: Flask = (source)

Undocumented

environ_base = (source)

Undocumented

preserve_context: bool = (source)

Undocumented

def _copy_environ(self, other): (source)

Undocumented

def _request_from_builder_args(self, args, kwargs): (source)

Undocumented

_context_stack = (source)

Undocumented

Undocumented