summaryrefslogtreecommitdiff
path: root/docs/narr/testing.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2020-01-16 10:01:29 -0600
committerGitHub <noreply@github.com>2020-01-16 10:01:29 -0600
commit9c153e1250e00faa06003c10c3a26886489e6210 (patch)
tree0bb4743f9e793e73c5f7a369d5744a1eff2e9c00 /docs/narr/testing.rst
parent912bccb8b715b0249c2c23736c467eaee14a4e3b (diff)
parentcc26acfd29c94036d1c4d9164dba6a2b7792c00a (diff)
downloadpyramid-9c153e1250e00faa06003c10c3a26886489e6210.tar.gz
pyramid-9c153e1250e00faa06003c10c3a26886489e6210.tar.bz2
pyramid-9c153e1250e00faa06003c10c3a26886489e6210.zip
Merge pull request #3557 from mmerickel/security-docs
update docs to use security policy
Diffstat (limited to 'docs/narr/testing.rst')
-rw-r--r--docs/narr/testing.rst23
1 files changed, 15 insertions, 8 deletions
diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst
index 0fa1e98fd..bb23d5137 100644
--- a/docs/narr/testing.rst
+++ b/docs/narr/testing.rst
@@ -395,23 +395,30 @@ As always, whenever you change your dependencies, make sure to run the correct
$VENV/bin/pip install -e ".[testing]"
-In your ``MyPackage`` project, your :term:`package` is named ``myproject``
+In your ``myproject`` project, your :term:`package` is named ``myproject``
which contains a ``views`` package containing a ``default.py`` module, which in turn contains a :term:`view`
function ``my_view`` that returns an HTML body when the root URL is invoked:
- .. literalinclude:: myproject/myproject/views/default.py
- :linenos:
- :language: python
+ .. literalinclude:: myproject/myproject/views/default.py
+ :linenos:
+ :language: python
+
+Test configuration and fixtures are defined in ``conftest.py``.
+In the following example, we define a test fixture.
+
+ .. literalinclude:: myproject/tests/conftest.py
+ :pyobject: testapp
+ :linenos:
+ :language: python
-The following example functional tests demonstrate invoking the above :term:`view`:
+This fixture is used in the following example functional tests, to demonstrate invoking the above :term:`view`:
- .. literalinclude:: myproject/tests/test_it.py
+ .. literalinclude:: myproject/tests/test_functional.py
:linenos:
- :pyobject: FunctionalTests
:language: python
When these tests are run, each test method creates a "real" :term:`WSGI` application using the ``main`` function in your ``myproject.__init__`` module, using :term:`WebTest` to wrap that WSGI application.
-It assigns the result to ``self.testapp``.
+It assigns the result to ``res``.
In the test named ``test_root``, the ``TestApp``'s ``GET`` method is used to invoke the root URL.
An assertion is made that the returned HTML contains the text ``Pyramid``.