Compare commits

...

8 commits
main ... 2.0.x

Author SHA1 Message Date
David Lord
0305d31cb8
Merge pull request #4497 from greyli/bp-param-docs
Add missing docstring for Blueprint cli_group
2022-03-26 11:25:32 -07:00
Grey Li
4685c251c6 Add missing docstring for Blueprint cli_group 2022-03-26 09:24:50 +08:00
Grey Li
2e161a0b89
Merge pull request #4469 from greyli/fix-testing-docs 2022-02-27 21:27:51 +08:00
Grey Li
5be744ed55 Format code snippet in testing docs properly 2022-02-27 21:19:14 +08:00
David Lord
ab0269ad48
Merge pull request #4468 from Abdur-rahmaanJ/patch-4
docs: fix typo in testing example
2022-02-26 06:50:39 -08:00
Abdur-Rahmaan Janhangeer
21ee19c1b7
fix dict syntax in testing doc 2022-02-26 06:45:47 -08:00
David Lord
a466fc3ada
Merge pull request #4467 from pallets/docs-testing-query_string
update reference to 'query' parameter
2022-02-25 20:37:37 -08:00
usrme
89b7dc804e
update reference to 'query_string' parameter 2022-02-25 20:34:13 -08:00
2 changed files with 11 additions and 7 deletions

View file

@ -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

View file

@ -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.