summaryrefslogtreecommitdiff
path: root/docs/narr/testing.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2013-04-03 17:37:21 -0400
committerChris McDonough <chrism@plope.com>2013-04-03 17:37:21 -0400
commitd64fa6136d0dec6717b273362de548d8f3bf47e8 (patch)
tree23c77ac62ab9d6c93131874f835ae3166d4af53b /docs/narr/testing.rst
parent2ca9bde9d2862655ddee276cd14a375e6a5adec6 (diff)
parent84e455cf7c8d9cbfe6658548a61af2ecbbc1749e (diff)
downloadpyramid-d64fa6136d0dec6717b273362de548d8f3bf47e8.tar.gz
pyramid-d64fa6136d0dec6717b273362de548d8f3bf47e8.tar.bz2
pyramid-d64fa6136d0dec6717b273362de548d8f3bf47e8.zip
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/narr/testing.rst')
-rw-r--r--docs/narr/testing.rst13
1 files changed, 7 insertions, 6 deletions
diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst
index 0801a8eae..bfb1287d9 100644
--- a/docs/narr/testing.rst
+++ b/docs/narr/testing.rst
@@ -128,7 +128,7 @@ functions accepts various arguments that influence the environment of the
test. See the :ref:`testing_module` chapter for information about the extra
arguments supported by these functions.
-If you also want to make :func:`~pyramid.get_current_request` return something
+If you also want to make :func:`~pyramid.threadlocal.get_current_request` return something
other than ``None`` during the course of a single test, you can pass a
:term:`request` object into the :func:`pyramid.testing.setUp` within the
``setUp`` method of your test:
@@ -231,7 +231,7 @@ application registry is not created and populated (e.g. by initializing the
configurator with an authorization policy), like when you invoke application
code via a unit test, :app:`Pyramid` API functions will tend to either fail
or return default results. So how do you test the branch of the code in this
-view function that raises :exc:`HTTPForbidden`?
+view function that raises :exc:`~pyramid.httpexceptions.HTTPForbidden`?
The testing API provided by :app:`Pyramid` allows you to simulate various
application registry registrations for use under a unit testing framework
@@ -272,7 +272,7 @@ without needing to invoke the actual application configuration implied by its
self.assertEqual(response, {'greeting':'hello'})
In the above example, we create a ``MyTest`` test case that inherits from
-:mod:`unittest.TestCase`. If it's in our :app:`Pyramid` application, it will
+:class:`unittest.TestCase`. If it's in our :app:`Pyramid` application, it will
be found when ``setup.py test`` is run. It has two test methods.
The first test method, ``test_view_fn_forbidden`` tests the ``view_fn`` when
@@ -287,8 +287,9 @@ request object that requires less setup than a "real" :app:`Pyramid` request.
We call the function being tested with the manufactured request. When the
function is called, :func:`pyramid.security.has_permission` will call the
"dummy" authentication policy we've registered through
-:meth:`~pyramid.config.Configuration.testing_securitypolicy`, which denies
-access. We check that the view function raises a :exc:`HTTPForbidden` error.
+:meth:`~pyramid.config.Configurator.testing_securitypolicy`, which denies
+access. We check that the view function raises a
+:exc:`~pyramid.httpexceptions.HTTPForbidden` error.
The second test method, named ``test_view_fn_allowed`` tests the alternate
case, where the authentication policy allows access. Notice that we pass
@@ -425,4 +426,4 @@ invoke the root URL. We then assert that the returned HTML has the string
``Pyramid`` in it.
See the :term:`WebTest` documentation for further information about the
-methods available to a :class:`webtest.TestApp` instance.
+methods available to a :class:`webtest.app.TestApp` instance.