diff options
| author | Chris McDonough <chrism@plope.com> | 2014-12-16 19:48:53 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2014-12-16 19:48:53 -0500 |
| commit | 27db38880d46b6f4345cf86766924de976e24177 (patch) | |
| tree | 8c5dcf10f1177e6b0fc212cd8fa0eea20ecf9f5d /docs/narr/MyProject/myproject | |
| parent | b1fac53cd0c3b930aec90e27f4d19c5f785f52e2 (diff) | |
| parent | cc15bbf7de74f4cdfc676e34fa429d2658d1ddf6 (diff) | |
| download | pyramid-27db38880d46b6f4345cf86766924de976e24177.tar.gz pyramid-27db38880d46b6f4345cf86766924de976e24177.tar.bz2 pyramid-27db38880d46b6f4345cf86766924de976e24177.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/narr/MyProject/myproject')
| -rw-r--r-- | docs/narr/MyProject/myproject/tests.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/narr/MyProject/myproject/tests.py b/docs/narr/MyProject/myproject/tests.py index 64dcab1d5..8c60407e5 100644 --- a/docs/narr/MyProject/myproject/tests.py +++ b/docs/narr/MyProject/myproject/tests.py @@ -15,3 +15,40 @@ class ViewTests(unittest.TestCase): request = testing.DummyRequest() info = my_view(request) self.assertEqual(info['project'], 'MyProject') + +class ViewIntegrationTests(unittest.TestCase): + def setUp(self): + """ This sets up the application registry with the + registrations your application declares in its ``includeme`` + function. + """ + self.config = testing.setUp() + self.config.include('myproject') + + def tearDown(self): + """ Clear out the application registry """ + testing.tearDown() + + def test_my_view(self): + from myproject.views import my_view + request = testing.DummyRequest() + result = my_view(request) + self.assertEqual(result.status, '200 OK') + body = result.app_iter[0] + self.assertTrue('Welcome to' in body) + self.assertEqual(len(result.headerlist), 2) + self.assertEqual(result.headerlist[0], + ('Content-Type', 'text/html; charset=UTF-8')) + self.assertEqual(result.headerlist[1], ('Content-Length', + str(len(body)))) + +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('Pyramid' in res.body) |
