Browse Source

Add a little documentation regarding kwargs in the `app.test_client()` method

pull/992/merge
Matt Wright 11 years ago committed by Markus Unterwaditzer
parent
commit
44c025f552
  1. 14
      flask/app.py

14
flask/app.py

@ -844,6 +844,20 @@ class Flask(_PackageBoundObject):
rv = c.get('/?vodka=42') rv = c.get('/?vodka=42')
assert request.args['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. See :class:`~flask.testing.FlaskClient` for more information.
.. versionchanged:: 0.4 .. versionchanged:: 0.4

Loading…
Cancel
Save