From 44c025f552075175fc8335f327c0e825e05527dc Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Thu, 13 Mar 2014 18:59:59 -0400 Subject: [PATCH] Add a little documentation regarding kwargs in the `app.test_client()` method --- flask/app.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/flask/app.py b/flask/app.py index 3d6e2d72..050fcb3e 100644 --- a/flask/app.py +++ b/flask/app.py @@ -844,6 +844,20 @@ class Flask(_PackageBoundObject): rv = c.get('/?vodka=42') assert request.args['vodka'] == '42' + Additionally, you may pass optional keyword arguments that will then + be passed to the application's :attr:`test_client_class` constructor. + For example:: + + from flask.testing import FlaskClient + + class CustomClient(FlaskClient): + def __init__(self, authentication=None, *args, **kwargs): + FlaskClient.__init__(*args, **kwargs) + self._authentication = authentication + + app.test_client_class = CustomClient + client = app.test_client(authentication='Basic ....') + See :class:`~flask.testing.FlaskClient` for more information. .. versionchanged:: 0.4