summaryrefslogtreecommitdiff
path: root/docs/narr/myproject/tests/test_it.py
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2020-01-01 18:27:30 -0800
committerSteve Piercy <web@stevepiercy.com>2020-01-02 23:30:59 -0800
commitdece4d25b136a493dfeeeb516487d4d756bc69e9 (patch)
tree86ad34f28e774667b28109c82f4dd8d0a4249e7b /docs/narr/myproject/tests/test_it.py
parent3157775a08ff9e48b0fff8057f4482d78d266f01 (diff)
downloadpyramid-dece4d25b136a493dfeeeb516487d4d756bc69e9.tar.gz
pyramid-dece4d25b136a493dfeeeb516487d4d756bc69e9.tar.bz2
pyramid-dece4d25b136a493dfeeeb516487d4d756bc69e9.zip
Resync through project.rst after moving tests directory
Diffstat (limited to 'docs/narr/myproject/tests/test_it.py')
-rw-r--r--docs/narr/myproject/tests/test_it.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/docs/narr/myproject/tests/test_it.py b/docs/narr/myproject/tests/test_it.py
new file mode 100644
index 000000000..b300da34d
--- /dev/null
+++ b/docs/narr/myproject/tests/test_it.py
@@ -0,0 +1,39 @@
+import unittest
+
+from pyramid import testing
+
+
+class ViewTests(unittest.TestCase):
+ def setUp(self):
+ self.config = testing.setUp()
+
+ def tearDown(self):
+ testing.tearDown()
+
+ def test_my_view(self):
+ from myproject.views.default import my_view
+ request = testing.DummyRequest()
+ info = my_view(request)
+ self.assertEqual(info['project'], 'myproject')
+
+ def test_notfound_view(self):
+ from myproject.views.notfound import notfound_view
+ request = testing.DummyRequest()
+ info = notfound_view(request)
+ self.assertEqual(info, {})
+
+
+class FunctionalTests(unittest.TestCase):
+ def setUp(self):
+ from myproject import main
+ app = main({})
+ from webtest import TestApp
+ self.testapp = TestApp(app)
+
+ def test_root(self):
+ res = self.testapp.get('/', status=200)
+ self.assertTrue(b'Pyramid' in res.body)
+
+ def test_notfound(self):
+ res = self.testapp.get('/badurl', status=404)
+ self.assertTrue(res.status_code == 404)