summaryrefslogtreecommitdiff
path: root/docs/narr/myproject/tests/test_it.py
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2020-01-03 23:14:53 -0600
committerMichael Merickel <michael@merickel.org>2020-01-03 23:14:53 -0600
commit828e069de5d0c98e6d54cfdbf20b1a8acd1f6b39 (patch)
treebe692270de956199b4cfb1eda8a9fc24ceb8374e /docs/narr/myproject/tests/test_it.py
parent7820b922cc1b87147cc60288dff0bbdfd7b5bc8a (diff)
parent148cf5138638ce6b1b92b4e13fe1444df9451e34 (diff)
downloadpyramid-828e069de5d0c98e6d54cfdbf20b1a8acd1f6b39.tar.gz
pyramid-828e069de5d0c98e6d54cfdbf20b1a8acd1f6b39.tar.bz2
pyramid-828e069de5d0c98e6d54cfdbf20b1a8acd1f6b39.zip
Merge branch 'master' into security-docs
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)