Compare commits
8 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0305d31cb8 | ||
|
|
4685c251c6 | ||
|
|
2e161a0b89 | ||
|
|
5be744ed55 | ||
|
|
ab0269ad48 | ||
|
|
21ee19c1b7 | ||
|
|
a466fc3ada | ||
|
|
89b7dc804e |
2 changed files with 11 additions and 7 deletions
|
|
@ -92,7 +92,7 @@ The ``client`` has methods that match the common HTTP request methods,
|
|||
such as ``client.get()`` and ``client.post()``. They take many arguments
|
||||
for building the request; you can find the full documentation in
|
||||
:class:`~werkzeug.test.EnvironBuilder`. Typically you'll use ``path``,
|
||||
``query``, ``headers``, and ``data`` or ``json``.
|
||||
``query_string``, ``headers``, and ``data`` or ``json``.
|
||||
|
||||
To make a request, call the method the request should use with the path
|
||||
to the route to test. A :class:`~werkzeug.test.TestResponse` is returned
|
||||
|
|
@ -108,9 +108,11 @@ provides ``response.text``, or use ``response.get_data(as_text=True)``.
|
|||
assert b"<h2>Hello, World!</h2>" in response.data
|
||||
|
||||
|
||||
Pass a dict ``query={"key": "value", ...}`` to set arguments in the
|
||||
query string (after the ``?`` in the URL). Pass a dict ``headers={}``
|
||||
to set request headers.
|
||||
Pass a dict ``query_string={"key": "value", ...}`` to set arguments in
|
||||
the query string (after the ``?`` in the URL). You can also pass a
|
||||
string if you want to set a specific value directly.
|
||||
|
||||
Pass a dict to ``headers={}`` to set request headers.
|
||||
|
||||
To send a request body in a POST or PUT request, pass a value to
|
||||
``data``. If raw bytes are passed, that exact body is used. Usually,
|
||||
|
|
@ -142,9 +144,9 @@ use ``pathlib.Path`` to get files relative to the current test file.
|
|||
|
||||
def test_edit_user(client):
|
||||
response = client.post("/user/2/edit", data={
|
||||
name="Flask",
|
||||
theme="dark",
|
||||
picture=(resources / "picture.png").open("rb"),
|
||||
"name": "Flask",
|
||||
"theme": "dark",
|
||||
"picture": (resources / "picture.png").open("rb"),
|
||||
})
|
||||
assert response.status_code == 200
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,8 @@ class Blueprint(Scaffold):
|
|||
this based on ``import_name``. In certain situations this
|
||||
automatic detection can fail, so the path can be specified
|
||||
manually instead.
|
||||
:param cli_group: The name of the blueprint's CLI group. If not set,
|
||||
the blueprint name will be used.
|
||||
|
||||
.. versionchanged:: 1.1.0
|
||||
Blueprints have a ``cli`` group to register nested CLI commands.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue