diff options
| author | Michael Merickel <michael@merickel.org> | 2020-01-03 23:14:26 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-03 23:14:26 -0600 |
| commit | 148cf5138638ce6b1b92b4e13fe1444df9451e34 (patch) | |
| tree | 7b088836b570b401caf510f130f144404cb19ca4 /docs/quick_tour/sessions/tests/test_it.py | |
| parent | cc396692d82441f8142fb14041542ebd2dad6f0a (diff) | |
| parent | b349c2ba948148d2f5441308c6646f624100b364 (diff) | |
| download | pyramid-148cf5138638ce6b1b92b4e13fe1444df9451e34.tar.gz pyramid-148cf5138638ce6b1b92b4e13fe1444df9451e34.tar.bz2 pyramid-148cf5138638ce6b1b92b4e13fe1444df9451e34.zip | |
Merge pull request #3556 from stevepiercy/docs-synch-cookiecutter-pr-71
Update docs to sync with cookiecutter master branch
Diffstat (limited to 'docs/quick_tour/sessions/tests/test_it.py')
| -rw-r--r-- | docs/quick_tour/sessions/tests/test_it.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/docs/quick_tour/sessions/tests/test_it.py b/docs/quick_tour/sessions/tests/test_it.py new file mode 100644 index 000000000..90c6302fe --- /dev/null +++ b/docs/quick_tour/sessions/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 hello_world.views.default import my_view + request = testing.DummyRequest() + info = my_view(request) + self.assertEqual(info['project'], 'hello_world') + + def test_notfound_view(self): + from hello_world.views.notfound import notfound_view + request = testing.DummyRequest() + info = notfound_view(request) + self.assertEqual(info, {}) + + +class FunctionalTests(unittest.TestCase): + def setUp(self): + from hello_world 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) |
