From 80e9923262fee4892a750d0d6366b193cb4204ba Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 1 Jan 2020 17:40:46 -0800 Subject: Resync through Quick Tour after moving tests directory --- docs/quick_tour/sessions/tests/test_it.py | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 docs/quick_tour/sessions/tests/test_it.py (limited to 'docs/quick_tour/sessions/tests/test_it.py') 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) -- cgit v1.2.3