class Client:
This class allows you to send requests to a wrapped application.
The use_cookies parameter indicates whether cookies should be stored and sent for subsequent requests. This is True by default, but passing False will disable this behaviour.
If you want to request some subdomain of your application you may set
allow_subdomain_redirects
to True
as if not no external redirects
are allowed.
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | delete |
Call open with method set to DELETE. |
Method | delete_cookie |
Deletes a cookie in the test client. |
Method | get |
Call open with method set to GET. |
Method | head |
Call open with method set to HEAD. |
Method | open |
Generate an environ dict from the given arguments, make a request to the application using it, and return the response. |
Method | options |
Call open with method set to OPTIONS. |
Method | patch |
Call open with method set to PATCH. |
Method | post |
Call open with method set to POST. |
Method | put |
Call open with method set to PUT. |
Method | resolve_redirect |
Perform a new request to the location given by the redirect response to the previous request. |
Method | run_wsgi_app |
Runs the wrapped WSGI app with the given environment. |
Method | set_cookie |
Sets a cookie in the client's cookie jar. The server name is required and has to match the one that is also passed to the open call. |
Method | trace |
Call open with method set to TRACE. |
Instance Variable | allow_subdomain_redirects |
Undocumented |
Instance Variable | application |
Undocumented |
Instance Variable | cookie_jar |
Undocumented |
Instance Variable | response_wrapper |
Undocumented |
Undocumented
Parameters | |
application:WSGIApplication | Undocumented |
response_wrapper:t.Optional[ | Undocumented |
use_cookies:bool | Undocumented |
allow_subdomain_redirects:bool | Undocumented |
open
with method set to DELETE.Parameters | |
*args:t.Any | Undocumented |
**kw:t.Any | Undocumented |
Returns | |
TestResponse | Undocumented |
Parameters | |
server_name:str | Undocumented |
key:str | Undocumented |
path:str | Undocumented |
domain:t.Optional[ | Undocumented |
secure:bool | Undocumented |
httponly:bool | Undocumented |
samesite:t.Optional[ | Undocumented |
open
with method set to GET.Parameters | |
*args:t.Any | Undocumented |
**kw:t.Any | Undocumented |
Returns | |
TestResponse | Undocumented |
open
with method set to HEAD.Parameters | |
*args:t.Any | Undocumented |
**kw:t.Any | Undocumented |
Returns | |
TestResponse | Undocumented |
Generate an environ dict from the given arguments, make a request to the application using it, and return the response.
TestResponse.request
and
request.environ instead.werkzeug.FileWrapper
.Parameters | |
*args:t.Any | Passed to EnvironBuilder to create the
environ for the request. If a single arg is passed, it can
be an existing EnvironBuilder or an environ dict. |
as_tuple:bool | Undocumented |
buffered:bool | Convert the iterator returned by the app into a list. If the iterator has a close() method, it is called automatically. |
follow_redirects:bool | Make additional requests to follow HTTP
redirects until a non-redirect status is returned.
TestResponse.history lists the intermediate
responses. |
**kwargs:t.Any | Undocumented |
Returns | |
TestResponse | Undocumented |
open
with method set to OPTIONS.Parameters | |
*args:t.Any | Undocumented |
**kw:t.Any | Undocumented |
Returns | |
TestResponse | Undocumented |
open
with method set to PATCH.Parameters | |
*args:t.Any | Undocumented |
**kw:t.Any | Undocumented |
Returns | |
TestResponse | Undocumented |
open
with method set to POST.Parameters | |
*args:t.Any | Undocumented |
**kw:t.Any | Undocumented |
Returns | |
TestResponse | Undocumented |
open
with method set to PUT.Parameters | |
*args:t.Any | Undocumented |
**kw:t.Any | Undocumented |
Returns | |
TestResponse | Undocumented |
Parameters | |
response:TestResponse | Undocumented |
buffered:bool | Undocumented |
Returns | |
TestResponse | Undocumented |
Unknown Field: meta | |
private |
Parameters | |
environ:WSGIEnvironment | Undocumented |
buffered:bool | Undocumented |
Returns | |
t.Tuple[ | Undocumented |
Unknown Field: meta | |
private |
Parameters | |
server_name:str | Undocumented |
key:str | Undocumented |
value:str | Undocumented |
max_age:t.Optional[ | Undocumented |
expires:t.Optional[ | Undocumented |
path:str | Undocumented |
domain:t.Optional[ | Undocumented |
secure:bool | Undocumented |
httponly:bool | Undocumented |
samesite:t.Optional[ | Undocumented |
charset:str | Undocumented |
open
with method set to TRACE.Parameters | |
*args:t.Any | Undocumented |
**kw:t.Any | Undocumented |
Returns | |
TestResponse | Undocumented |