diff options
| author | Steve Piercy <web@stevepiercy.com> | 2017-08-15 01:44:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-15 01:44:17 -0700 |
| commit | df2a517acb68100c679fc38bf0c53c5c15dde62f (patch) | |
| tree | 8826d1204f901ccb5138cd14c1426aa759e97011 | |
| parent | ba5732f5d3c82282ef5f20661308f77b70208474 (diff) | |
| parent | c6ede2dbca90b4fa752a9dfe35dbb1325e522498 (diff) | |
| download | pyramid-df2a517acb68100c679fc38bf0c53c5c15dde62f.tar.gz pyramid-df2a517acb68100c679fc38bf0c53c5c15dde62f.tar.bz2 pyramid-df2a517acb68100c679fc38bf0c53c5c15dde62f.zip | |
Merge pull request #3152 from larsblumberg/master
Add a functional test for the static file
| -rw-r--r-- | CONTRIBUTORS.txt | 3 | ||||
| -rw-r--r-- | docs/quick_tutorial/static_assets.rst | 11 | ||||
| -rw-r--r-- | docs/quick_tutorial/static_assets/tutorial/tests.py | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 062dcafd7..a2f642c17 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -310,3 +310,6 @@ Contributors - Denis Rykov, 2017/06/15 - Tosh Lyons, 2017/06/27 + +- Lars Blumberg, 2017/08/14 + diff --git a/docs/quick_tutorial/static_assets.rst b/docs/quick_tutorial/static_assets.rst index b8482492d..81a01061a 100644 --- a/docs/quick_tutorial/static_assets.rst +++ b/docs/quick_tutorial/static_assets.rst @@ -43,13 +43,20 @@ Steps .. literalinclude:: static_assets/tutorial/static/app.css :language: css -#. Make sure we haven't broken any existing code by running the tests: +#. We add a functional test that asserts that the newly added static file is delivered: + + .. literalinclude:: static_assets/tutorial/tests.py + :language: python + :pyobject: TutorialFunctionalTests.test_css + :lineno-match: + +#. Now run the tests: .. code-block:: bash $ $VENV/bin/py.test tutorial/tests.py -q .... - 4 passed in 0.50 seconds + 5 passed in 0.50 seconds #. Run your Pyramid application with: diff --git a/docs/quick_tutorial/static_assets/tutorial/tests.py b/docs/quick_tutorial/static_assets/tutorial/tests.py index 4381235ec..b560ddf82 100644 --- a/docs/quick_tutorial/static_assets/tutorial/tests.py +++ b/docs/quick_tutorial/static_assets/tutorial/tests.py @@ -42,3 +42,7 @@ class TutorialFunctionalTests(unittest.TestCase): def test_hello(self): res = self.testapp.get('/howdy', status=200) self.assertIn(b'<h1>Hi Hello View', res.body) + + def test_css(self): + res = self.testapp.get('/static/app.css', status=200) + self.assertIn(b'body', res.body) |
