From 6c9959c34b403c2b1e3088d34b67bef5c79ee9fc Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 1 Jul 2011 02:23:39 -0400 Subject: fix wiki tests too --- docs/tutorials/wiki/tests.rst | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index c843a0129..841baa8d1 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -52,8 +52,34 @@ Running the Tests ================= We can run these tests by using ``setup.py test`` in the same way we did in -:ref:`running_tests`. Assuming our shell's current working directory is the -"tutorial" distribution directory: +:ref:`running_tests`. However, first we must edit our ``setup.py`` to +include a dependency on WebTest, which we've used in our ``tests.py``. +Change the ``requires`` list in ``setup.py`` to include ``WebTest``. + +.. literalinclude:: src/tests/setup.py + :linenos: + :language: python + :lines: 9-18 + +After we've added a dependency on WebTest in ``setup.py``, we need to rerun +``setup.py develop`` to get WebTest installed into our virtualenv. Assuming +our shell's current working directory is the "tutorial" distribution +directory: + +On UNIX: + +.. code-block:: text + + $ ../bin/python setup.py develop + +On Windows: + +.. code-block:: text + + c:\pyramidtut\tutorial> ..\Scripts\python setup.py develop + +Once that command has completed successfully, we can run the tests +themselves: On UNIX: -- cgit v1.2.3 From 19799769801c2e0bdca18f6f1e7336c1a2a07eb6 Mon Sep 17 00:00:00 2001 From: kenmanheimer Date: Tue, 8 Nov 2011 15:02:46 -0800 Subject: Track change of the scaffolding file names, removing 'pyramid_' prefix. --- docs/tutorials/wiki/tests.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 841baa8d1..c03b6b958 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -15,7 +15,7 @@ class for each model class, and we'll write a test class for the ``appmaker``. To do so, we'll retain the ``tutorial.tests.ViewTests`` class provided as a -result of the ``pyramid_zodb`` project generator. We'll add three test +result of the ``zodb`` project generator. We'll add three test classes: one for the ``Page`` model named ``PageModelTests``, one for the ``Wiki`` model named ``WikiModelTests``, and one for the appmaker named ``AppmakerTests``. -- cgit v1.2.3 From 9b215d25112e7f466512ebbcfb2007abe070c9f7 Mon Sep 17 00:00:00 2001 From: kenmanheimer Date: Tue, 8 Nov 2011 16:34:20 -0800 Subject: Use active ("Run the Tests") rather than passive ("Running the Tests") voice for the headings. --- docs/tutorials/wiki/tests.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index c03b6b958..941302d67 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -6,8 +6,8 @@ We will now add tests for the models and the views and a few functional tests in the ``tests.py``. Tests ensure that an application works, and that it continues to work after some changes are made in the future. -Testing the Models -================== +Test the Models +=============== We write tests for the model classes and the appmaker. Changing ``tests.py``, we'll write a separate test @@ -20,8 +20,8 @@ classes: one for the ``Page`` model named ``PageModelTests``, one for the ``Wiki`` model named ``WikiModelTests``, and one for the appmaker named ``AppmakerTests``. -Testing the Views -================= +Test the Views +============== We'll modify our ``tests.py`` file, adding tests for each view function we added above. As a result, we'll *delete* the ``ViewTests`` test in the file, @@ -38,8 +38,8 @@ tested in the unit tests, like logging in, logging out, checking that the ``viewer`` user cannot add or edit pages, but the ``editor`` user can, and so on. -Viewing the results of all our edits to ``tests.py`` -==================================================== +View the results of all our edits to ``tests.py`` +================================================= Once we're done with the ``tests.py`` module, it will look a lot like the below: @@ -48,8 +48,8 @@ below: :linenos: :language: python -Running the Tests -================= +Run the Tests +============= We can run these tests by using ``setup.py test`` in the same way we did in :ref:`running_tests`. However, first we must edit our ``setup.py`` to -- cgit v1.2.3 From ed252bfa447e29a2cf56f51d759be342baf16f3a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 28 Nov 2011 15:53:55 -0500 Subject: move code from login.py to views.py (like sqla tutorial) --- docs/tutorials/wiki/tests.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 941302d67..1ddb8f408 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -9,10 +9,9 @@ that it continues to work after some changes are made in the future. Test the Models =============== -We write tests for the model -classes and the appmaker. Changing ``tests.py``, we'll write a separate test -class for each model class, and we'll write a test class for the -``appmaker``. +We write tests for the model classes and the appmaker. Changing +``tests.py``, we'll write a separate test class for each model class, and +we'll write a test class for the ``appmaker``. To do so, we'll retain the ``tutorial.tests.ViewTests`` class provided as a result of the ``zodb`` project generator. We'll add three test -- cgit v1.2.3 From 2eaaccc3dea2a28938b2e0382a0f5320b2a1cdd7 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 17 Mar 2012 13:45:50 -0400 Subject: link to tests stage source --- docs/tutorials/wiki/tests.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 1ddb8f408..ebb4d93dc 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -6,6 +6,10 @@ We will now add tests for the models and the views and a few functional tests in the ``tests.py``. Tests ensure that an application works, and that it continues to work after some changes are made in the future. +The source code for this tutorial stage can be browsed via +`http://github.com/Pylons/pyramid/tree/1.3-branch/docs/tutorials/wiki/src/tests/ +`_. + Test the Models =============== -- cgit v1.2.3 From 02d18abdc79a727b1e148dc8718a9c15fe613be0 Mon Sep 17 00:00:00 2001 From: Patricio Paez Date: Thu, 22 Nov 2012 06:51:25 -0600 Subject: Sync the tutorial docs for the transaction dependency --- docs/tutorials/wiki/tests.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index ebb4d93dc..46d009d0f 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -62,7 +62,7 @@ Change the ``requires`` list in ``setup.py`` to include ``WebTest``. .. literalinclude:: src/tests/setup.py :linenos: :language: python - :lines: 9-18 + :lines: 9-19 After we've added a dependency on WebTest in ``setup.py``, we need to rerun ``setup.py develop`` to get WebTest installed into our virtualenv. Assuming -- cgit v1.2.3 From 2a98712048133353392b9e725a24499acd48d605 Mon Sep 17 00:00:00 2001 From: Patricio Paez Date: Thu, 13 Dec 2012 07:08:23 -0600 Subject: Improvements to the ZODB tutorial Tests chapter - Standardize with the SQL tutorial --- docs/tutorials/wiki/tests.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 46d009d0f..7a019dd04 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -17,8 +17,8 @@ We write tests for the model classes and the appmaker. Changing ``tests.py``, we'll write a separate test class for each model class, and we'll write a test class for the ``appmaker``. -To do so, we'll retain the ``tutorial.tests.ViewTests`` class provided as a -result of the ``zodb`` project generator. We'll add three test +To do so, we'll retain the ``tutorial.tests.ViewTests`` class that was +generated as part of the ``zodb`` scaffold. We'll add three test classes: one for the ``Page`` model named ``PageModelTests``, one for the ``Wiki`` model named ``WikiModelTests``, and one for the appmaker named ``AppmakerTests``. @@ -51,8 +51,8 @@ below: :linenos: :language: python -Run the Tests -============= +Running the Tests +================= We can run these tests by using ``setup.py test`` in the same way we did in :ref:`running_tests`. However, first we must edit our ``setup.py`` to @@ -63,6 +63,7 @@ Change the ``requires`` list in ``setup.py`` to include ``WebTest``. :linenos: :language: python :lines: 9-19 + :emphasize-lines: 10 After we've added a dependency on WebTest in ``setup.py``, we need to rerun ``setup.py develop`` to get WebTest installed into our virtualenv. Assuming -- cgit v1.2.3 From 445eb8708fa48209947377f6de609799dd843ad6 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 20 Jan 2013 17:10:40 +0200 Subject: point to the sources of the wiki tutorials in just one location; fix #763 * This avoids having to update the link multiple times. * Also, mention their location, in case user has Pyramid checkout. --- docs/tutorials/wiki/tests.rst | 3 --- 1 file changed, 3 deletions(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 7a019dd04..49bc780e8 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -6,9 +6,6 @@ We will now add tests for the models and the views and a few functional tests in the ``tests.py``. Tests ensure that an application works, and that it continues to work after some changes are made in the future. -The source code for this tutorial stage can be browsed via -`http://github.com/Pylons/pyramid/tree/1.3-branch/docs/tutorials/wiki/src/tests/ -`_. Test the Models =============== -- cgit v1.2.3 From eb3cee262ef52480198fc7f506debe0f35e3554a Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 4 Mar 2013 22:30:32 +0200 Subject: fix #311 --- docs/tutorials/wiki/tests.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 49bc780e8..36ae7930b 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -59,7 +59,7 @@ Change the ``requires`` list in ``setup.py`` to include ``WebTest``. .. literalinclude:: src/tests/setup.py :linenos: :language: python - :lines: 9-19 + :lines: 11-21 :emphasize-lines: 10 After we've added a dependency on WebTest in ``setup.py``, we need to rerun -- cgit v1.2.3 From f73f0e332658fac2583f51247dcd49bd36d63ce4 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 13 Mar 2013 23:05:17 +0200 Subject: consistency: use $VENV whenever virtualenv binaries are used --- docs/tutorials/wiki/tests.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 36ae7930b..e40dc286b 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -71,13 +71,13 @@ On UNIX: .. code-block:: text - $ ../bin/python setup.py develop + $ $VENV/bin/python setup.py develop On Windows: .. code-block:: text - c:\pyramidtut\tutorial> ..\Scripts\python setup.py develop + c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py develop Once that command has completed successfully, we can run the tests themselves: @@ -86,13 +86,13 @@ On UNIX: .. code-block:: text - $ ../bin/python setup.py test -q + $ $VENV/bin/python setup.py test -q On Windows: .. code-block:: text - c:\pyramidtut\tutorial> ..\Scripts\python setup.py test -q + c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py test -q The expected result looks something like: -- cgit v1.2.3 From 404b28ba2efb02d93777a3e01fd602c96af8c077 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Fri, 6 Sep 2013 00:02:46 -0500 Subject: update the code in the wiki and wiki2 tutorials to use pyramid_chameleon --- docs/tutorials/wiki/tests.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index e40dc286b..e724f3e18 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -59,8 +59,8 @@ Change the ``requires`` list in ``setup.py`` to include ``WebTest``. .. literalinclude:: src/tests/setup.py :linenos: :language: python - :lines: 11-21 - :emphasize-lines: 10 + :lines: 11-22 + :emphasize-lines: 11 After we've added a dependency on WebTest in ``setup.py``, we need to rerun ``setup.py develop`` to get WebTest installed into our virtualenv. Assuming -- cgit v1.2.3 From 6901d74698da7b8457f92f0771fe03015acb9261 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 27 May 2015 03:38:39 -0700 Subject: - clean up and make consistent across wiki tutorials - update templates and static assets for new design --- docs/tutorials/wiki/tests.rst | 44 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index e724f3e18..e255812fc 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -2,38 +2,36 @@ Adding Tests ============ -We will now add tests for the models and the views and a few functional -tests in the ``tests.py``. Tests ensure that an application works, and -that it continues to work after some changes are made in the future. +We will now add tests for the models and the views and a few functional tests +in ``tests.py``. Tests ensure that an application works, and that it +continues to work when changes are made in the future. - -Test the Models +Test the models =============== -We write tests for the model classes and the appmaker. Changing -``tests.py``, we'll write a separate test class for each model class, and +We write tests for the ``model`` classes and the ``appmaker``. Changing +``tests.py``, we'll write a separate test class for each ``model`` class, and we'll write a test class for the ``appmaker``. To do so, we'll retain the ``tutorial.tests.ViewTests`` class that was -generated as part of the ``zodb`` scaffold. We'll add three test -classes: one for the ``Page`` model named ``PageModelTests``, one for the -``Wiki`` model named ``WikiModelTests``, and one for the appmaker named -``AppmakerTests``. +generated as part of the ``zodb`` scaffold. We'll add three test classes: one +for the ``Page`` model named ``PageModelTests``, one for the ``Wiki`` model +named ``WikiModelTests``, and one for the appmaker named ``AppmakerTests``. -Test the Views +Test the views ============== We'll modify our ``tests.py`` file, adding tests for each view function we -added above. As a result, we'll *delete* the ``ViewTests`` test in the file, -and add four other test classes: ``ViewWikiTests``, ``ViewPageTests``, -``AddPageTests``, and ``EditPageTests``. These test the ``view_wiki``, -``view_page``, ``add_page``, and ``edit_page`` views respectively. - +added previously. As a result, we'll *delete* the ``ViewTests`` class that +the ``zodb`` scaffold provided, and add four other test classes: +``ViewWikiTests``, ``ViewPageTests``, ``AddPageTests``, and ``EditPageTests``. +These test the ``view_wiki``, ``view_page``, ``add_page``, and ``edit_page`` +views. Functional tests ================ -We test the whole application, covering security aspects that are not +We'll test the whole application, covering security aspects that are not tested in the unit tests, like logging in, logging out, checking that the ``viewer`` user cannot add or edit pages, but the ``editor`` user can, and so on. @@ -41,14 +39,14 @@ can, and so on. View the results of all our edits to ``tests.py`` ================================================= -Once we're done with the ``tests.py`` module, it will look a lot like the -below: +Open the ``tutorial/tests.py`` module, and edit it such that it appears as +follows: .. literalinclude:: src/tests/tutorial/tests.py :linenos: :language: python -Running the Tests +Running the tests ================= We can run these tests by using ``setup.py test`` in the same way we did in @@ -62,7 +60,7 @@ Change the ``requires`` list in ``setup.py`` to include ``WebTest``. :lines: 11-22 :emphasize-lines: 11 -After we've added a dependency on WebTest in ``setup.py``, we need to rerun +After we've added a dependency on WebTest in ``setup.py``, we need to run ``setup.py develop`` to get WebTest installed into our virtualenv. Assuming our shell's current working directory is the "tutorial" distribution directory: @@ -94,7 +92,7 @@ On Windows: c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py test -q -The expected result looks something like: +The expected result should look like the following: .. code-block:: text -- cgit v1.2.3 From 93a7a14d0abf0a7c1659275dc78ebc15247ca893 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 9 Apr 2016 15:17:52 -0700 Subject: - fix traversal tutorial reference - add intersphinx targets to wiki/* --- docs/tutorials/wiki/tests.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index e255812fc..3e083b24e 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -1,3 +1,5 @@ +.. _wiki_adding_tests: + ============ Adding Tests ============ -- cgit v1.2.3 From 63dcf93491fc9f5a7361d82240111446af0ca7ee Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 10 Apr 2016 02:19:59 -0700 Subject: - update wiki tests step and its src files - add test_referrer_is_login() to provide 100% coverage --- docs/tutorials/wiki/tests.rst | 44 +++++++------------------------------------ 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'docs/tutorials/wiki/tests.rst') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 3e083b24e..788ec595b 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -51,55 +51,25 @@ follows: Running the tests ================= -We can run these tests by using ``setup.py test`` in the same way we did in -:ref:`running_tests`. However, first we must edit our ``setup.py`` to -include a dependency on WebTest, which we've used in our ``tests.py``. -Change the ``requires`` list in ``setup.py`` to include ``WebTest``. - -.. literalinclude:: src/tests/setup.py - :linenos: - :language: python - :lines: 11-22 - :emphasize-lines: 11 - -After we've added a dependency on WebTest in ``setup.py``, we need to run -``setup.py develop`` to get WebTest installed into our virtualenv. Assuming -our shell's current working directory is the "tutorial" distribution -directory: - -On UNIX: - -.. code-block:: text - - $ $VENV/bin/python setup.py develop - -On Windows: - -.. code-block:: text - - c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py develop - -Once that command has completed successfully, we can run the tests -themselves: +We can run these tests by using ``py.test`` similarly to how we did in +:ref:`running_tests`. Our testing dependencies have already been satisfied, +courtesy of the scaffold, so we can jump right to running tests. On UNIX: .. code-block:: text - $ $VENV/bin/python setup.py test -q + $ $VENV/bin/py.test tutorial/tests.py -q On Windows: .. code-block:: text - c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py test -q + c:\pyramidtut\tutorial> %VENV%\Scripts\py.test tutorial/tests.py -q The expected result should look like the following: .. code-block:: text - ......... - ---------------------------------------------------------------------- - Ran 23 tests in 1.653s - - OK + ........................ + 24 passed in 2.46 seconds -- cgit v1.2.3