forked from orbit-oss/flask
Add a little documentation regarding kwargs in the app.test_client() method
This commit is contained in:
parent
fed6fd32d8
commit
44c025f552
1 changed files with 14 additions and 0 deletions
14
flask/app.py
14
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue