From 4ca67df229426972ff9a785abc060b4a33dfe953 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 28 Dec 2019 02:57:30 -0800 Subject: Update reference to tests in testing.rst --- docs/narr/testing.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'docs/narr/testing.rst') diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst index 2182082a8..ec2d1fad1 100644 --- a/docs/narr/testing.rst +++ b/docs/narr/testing.rst @@ -411,9 +411,8 @@ The following example functional test demonstrates invoking the above :pyobject: FunctionalTests :language: python -When this test is 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 +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``. In the test named ``test_root``, the ``TestApp``'s ``GET`` method is used to invoke the root URL. Finally, an assertion is made that the returned HTML contains the text ``Pyramid``. -- cgit v1.2.3 From dcdb9168aece7afd03194c11554d4a7e1bc32d06 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 1 Jan 2020 19:59:29 -0800 Subject: Fix broken literalinclude paths --- docs/narr/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/narr/testing.rst') diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst index ec2d1fad1..d89a4d3aa 100644 --- a/docs/narr/testing.rst +++ b/docs/narr/testing.rst @@ -406,7 +406,7 @@ function ``my_view`` that returns an HTML body when the root URL is invoked: The following example functional test demonstrates invoking the above :term:`view`: - .. literalinclude:: myproject/myproject/tests.py + .. literalinclude:: myproject/tests/test_it.py :linenos: :pyobject: FunctionalTests :language: python -- cgit v1.2.3 From e9fb506204aee7219c7ebf58bfcaf3e84e41e279 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 1 Jan 2020 21:47:58 -0800 Subject: Add missing description for new test in cookiecutter. --- docs/narr/testing.rst | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'docs/narr/testing.rst') diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst index d89a4d3aa..0fa1e98fd 100644 --- a/docs/narr/testing.rst +++ b/docs/narr/testing.rst @@ -403,8 +403,7 @@ function ``my_view`` that returns an HTML body when the root URL is invoked: :linenos: :language: python -The following example functional test demonstrates invoking the above -:term:`view`: +The following example functional tests demonstrate invoking the above :term:`view`: .. literalinclude:: myproject/tests/test_it.py :linenos: @@ -412,10 +411,13 @@ The following example functional test demonstrates invoking the above :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``. In the test named ``test_root``, the ``TestApp``'s ``GET`` -method is used to invoke the root URL. Finally, an assertion is made that the -returned HTML contains the text ``Pyramid``. +It assigns the result to ``self.testapp``. + +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``. + +In the test named ``test_notfound``, the ``TestApp``'s ``GET`` method is used to invoke a bad URL ``/badurl``. +An assertion is made that the returned status code in the response is ``404``. See the :term:`WebTest` documentation for further information about the methods available to a :class:`webtest.app.TestApp` instance. -- cgit v1.2.3