summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki2/tests.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2020-12-12 00:27:13 -0600
committerGitHub <noreply@github.com>2020-12-12 00:27:13 -0600
commitc261d2c92843b31d5e5394247b3c3aa8d89a08e1 (patch)
treea1dfc6642218964ffe634e967c72227e9c60d8d1 /docs/tutorials/wiki2/tests.rst
parent6cf061e170039ff48e7f892f1176d1ab359e2001 (diff)
parent2ce552b73fc40bd35565be0e4599bf2189ea6e09 (diff)
downloadpyramid-c261d2c92843b31d5e5394247b3c3aa8d89a08e1.tar.gz
pyramid-c261d2c92843b31d5e5394247b3c3aa8d89a08e1.tar.bz2
pyramid-c261d2c92843b31d5e5394247b3c3aa8d89a08e1.zip
Merge pull request #3629 from luhn/wiki2-request-identity
Remove request.user from wiki2
Diffstat (limited to 'docs/tutorials/wiki2/tests.rst')
-rw-r--r--docs/tutorials/wiki2/tests.rst7
1 files changed, 5 insertions, 2 deletions
diff --git a/docs/tutorials/wiki2/tests.rst b/docs/tutorials/wiki2/tests.rst
index 1bf38d988..dce14cf9b 100644
--- a/docs/tutorials/wiki2/tests.rst
+++ b/docs/tutorials/wiki2/tests.rst
@@ -69,6 +69,9 @@ Per-test fixtures
- ``dummy_request`` - a :class:`pyramid.testing.DummyRequest` object that is very lightweight.
This is a great object to pass to view functions that have minimal side-effects as it'll be fast and simple.
+- ``dummy_config`` — a :class:`pyramid.config.Configurator` object used as configuration by ``dummy_request``.
+ Useful for mocking configuration like routes and security policies.
+
Modifying the fixtures
----------------------
@@ -109,8 +112,8 @@ Integration tests
=================
We can directly execute the view code, bypassing :app:`Pyramid` and testing just the code that we've written.
-These tests use dummy requests that we'll prepare appropriately to set the conditions each view expects.
-For example, setting ``request.user``, or adding some dummy data to the session.
+These tests use dummy requests that we'll prepare appropriately to set the conditions each view expects, such as adding dummy data to the session.
+We'll be using ``dummy_config`` to configure the necessary routes, as well as setting the security policy as :class:`pyramid.testing.DummySecurityPolicy` to mock ``dummy_request.identity``.
Update ``tests/test_views.py`` such that it appears as follows: