Skip to content
Myr

fixing cross-referenced links on testing page

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by matt swanson · committed by matt swanson · parent 4141afa · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:docs/testing.rst+2 added-2 removed
11 unmodified lines
12safely change things, and you will instantly know if your change broke13something.1415Flask gives you a couple of ways to test applications. It mainly does16that by exposing the Werkzeug test :class:`~werkzeug.Client` class to your16that by exposing the Werkzeug test :class:`~werkzeug.test.Client` class to your17code and handling the context locals for you. You can then use that with18your favourite testing solution. In this documentation we will use the19:mod:`unittest` package that comes preinstalled with each Python20installation.
88 unmodified lines
109Test functions begin with the word `test`. Every function named like that110will be picked up automatically. By using `self.app.get` we can send an111HTTP `GET` request to the application with the given path. The return112value will be a :class:`~flask.Flask.response_class` object. We can now113use the :attr:`~werkzeug.BaseResponse.data` attribute to inspect the113use the :attr:`~werkzeug.wrappers.BaseResponse.data` attribute to inspect the114return value (as string) from the application. In this case, we ensure115that ``'No entries here so far'`` is part of the output.116117Run it again and you should see one passing test::
127 unmodified lines