class documentation

class FlaskClient(Client):

View In Hierarchy

Works like a regular Werkzeug test client but has some knowledge about how Flask works to defer the cleanup of the request context stack to the end of a with body when used in a with statement. For general information about how to use this class refer to werkzeug.test.Client.

Changed in version 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 open Undocumented
Method session​_transaction No summary
Method __enter__ Undocumented
Method __exit__ Undocumented
Method __init__ Undocumented
Class Variable application Undocumented
Instance Variable environ​_base Undocumented
Instance Variable preserve​_context Undocumented
def open(self, *args, as_tuple=False, buffered=False, follow_redirects=False, **kwargs):

Undocumented

Parameters
*args:t.AnyUndocumented
as​_tuple:boolUndocumented
buffered:boolUndocumented
follow​_redirects:boolUndocumented
**kwargs:t.AnyUndocumented
Returns
ResponseUndocumented
@contextmanager
def session_transaction(self, *args, **kwargs):

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 ~flask.Flask.test_request_context which are directly passed through.

Parameters
*args:t.AnyUndocumented
**kwargs:t.AnyUndocumented
Returns
t.Generator[SessionMixin, None, None]Undocumented
def __enter__(self):

Undocumented

Returns
FlaskClientUndocumented
def __exit__(self, exc_type, exc_value, tb):

Undocumented

Parameters
exc​_type:typeUndocumented
exc​_value:BaseExceptionUndocumented
tb:TracebackTypeUndocumented
def __init__(self, *args, **kwargs):

Undocumented

Parameters
*args:t.AnyUndocumented
**kwargs:t.AnyUndocumented
application: Flask =

Undocumented

environ_base =

Undocumented

preserve_context: bool =

Undocumented