From a9e8ac2f8e0d123d31c64346d380f1af2f6780d4 Mon Sep 17 00:00:00 2001
From: Steve Piercy <web@stevepiercy.com>
Date: Tue, 15 Aug 2017 10:49:09 +0200
Subject: [PATCH] backport #3152 from master to 1.9-branch - add functional test for static asset

---
 docs/quick_tutorial/static_assets/tutorial/tests.py |    4 ++++
 docs/quick_tutorial/static_assets.rst               |   11 +++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/docs/quick_tutorial/static_assets.rst b/docs/quick_tutorial/static_assets.rst
index b848249..81a0106 100644
--- a/docs/quick_tutorial/static_assets.rst
+++ b/docs/quick_tutorial/static_assets.rst
@@ -43,13 +43,20 @@
    .. 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 4381235..b560ddf 100644
--- a/docs/quick_tutorial/static_assets/tutorial/tests.py
+++ b/docs/quick_tutorial/static_assets/tutorial/tests.py
@@ -42,3 +42,7 @@
     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)

--
Gitblit v1.9.3