diff options
| author | Chris McDonough <chrism@plope.com> | 2013-04-23 12:10:16 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2013-04-23 12:10:16 -0400 |
| commit | 47b8cf7e9b578464b533383083f7135271db0f9e (patch) | |
| tree | 724c40d50f21773b6585ab7d9731b8bf7a93a71c /docs/narr/testing.rst | |
| parent | 2ae6f2cba5fc228e20c1ba26ad4f1411a63bbabb (diff) | |
| parent | dcaabcb87ca584c289efe70a604db0502838df3d (diff) | |
| download | pyramid-47b8cf7e9b578464b533383083f7135271db0f9e.tar.gz pyramid-47b8cf7e9b578464b533383083f7135271db0f9e.tar.bz2 pyramid-47b8cf7e9b578464b533383083f7135271db0f9e.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/narr/testing.rst')
| -rw-r--r-- | docs/narr/testing.rst | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst index bfb1287d9..ec5952a7c 100644 --- a/docs/narr/testing.rst +++ b/docs/narr/testing.rst @@ -125,7 +125,7 @@ method attached to ``MyTest`` will use an isolated registry. The :func:`~pyramid.testing.setUp` and :func:`~pyramid.testing.tearDown` functions accepts various arguments that influence the environment of the -test. See the :ref:`testing_module` chapter for information about the extra +test. See the :ref:`testing_module` API for information about the extra arguments supported by these functions. If you also want to make :func:`~pyramid.threadlocal.get_current_request` return something @@ -202,7 +202,7 @@ any ``get_current*`` function. Using the ``Configurator`` and ``pyramid.testing`` APIs in Unit Tests --------------------------------------------------------------------- -The ``Configurator`` API and the ``pyramid.testing`` module provide a number +The ``Configurator`` API and the :mod:`pyramid.testing` module provide a number of functions which can be used during unit testing. These functions make :term:`configuration declaration` calls to the current :term:`application registry`, but typically register a "stub" or "dummy" feature in place of the @@ -291,7 +291,7 @@ function is called, :func:`pyramid.security.has_permission` will call the 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 +The second test method, named ``test_view_fn_allowed``, tests the alternate case, where the authentication policy allows access. Notice that we pass different values to :meth:`~pyramid.config.Configurator.testing_securitypolicy` to obtain this @@ -373,7 +373,7 @@ after accessing some values that require a fully set up environment. result = my_view(request) self.assertEqual(result.status, '200 OK') body = result.app_iter[0] - self.failUnless('Welcome to' in body) + self.assertTrue('Welcome to' in body) self.assertEqual(len(result.headerlist), 2) self.assertEqual(result.headerlist[0], ('Content-Type', 'text/html; charset=UTF-8')) @@ -416,7 +416,7 @@ functional testing package written by Ian Bicking. def test_root(self): res = self.testapp.get('/', status=200) - self.failUnless('Pyramid' in res.body) + self.assertTrue('Pyramid' in res.body) When this test is run, each test creates a "real" WSGI application using the ``main`` function in your ``myapp.__init__`` module and uses :term:`WebTest` |
