diff options
| author | Chris McDonough <chrism@plope.com> | 2011-04-21 22:13:32 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-04-21 22:13:32 -0400 |
| commit | 44494c2d9d7266aede41c2ce72cb11b62c809b0a (patch) | |
| tree | 794aa6ebe5b27d1d65fdda7e5685b042c2a2434c | |
| parent | 8cf6dd15d512a8c0a4bab9a6b87aa519b8f6d5b3 (diff) | |
| download | pyramid-44494c2d9d7266aede41c2ce72cb11b62c809b0a.tar.gz pyramid-44494c2d9d7266aede41c2ce72cb11b62c809b0a.tar.bz2 pyramid-44494c2d9d7266aede41c2ce72cb11b62c809b0a.zip | |
add an integration test for wsgiapp2
| -rw-r--r-- | pyramid/tests/test_integration.py | 16 | ||||
| -rw-r--r-- | pyramid/tests/wsgiapp2app/__init__.py | 17 |
2 files changed, 33 insertions, 0 deletions
diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py index e3a1a8003..dd77d3aec 100644 --- a/pyramid/tests/test_integration.py +++ b/pyramid/tests/test_integration.py @@ -390,6 +390,22 @@ class SelfScanAppTest(unittest.TestCase): res = self.testapp.get('/two', status=200) self.assertTrue('two' in res.body) +class WSGIApp2AppTest(unittest.TestCase): + def setUp(self): + from pyramid.tests.wsgiapp2app import main + config = main() + app = config.make_wsgi_app() + from webtest import TestApp + self.testapp = TestApp(app) + self.config = config + + def tearDown(self): + self.config.end() + + def test_hello(self): + res = self.testapp.get('/hello', status=200) + self.assertTrue('Hello' in res.body) + class DummyContext(object): pass diff --git a/pyramid/tests/wsgiapp2app/__init__.py b/pyramid/tests/wsgiapp2app/__init__.py new file mode 100644 index 000000000..0880556ef --- /dev/null +++ b/pyramid/tests/wsgiapp2app/__init__.py @@ -0,0 +1,17 @@ +from pyramid.view import view_config +from pyramid.wsgi import wsgiapp2 + +@view_config(name='hello', renderer='string') +@wsgiapp2 +def hello(environ, start_response): + assert environ['PATH_INFO'] == '/' + assert environ['SCRIPT_NAME'] == '/hello' + response_headers = [('Content-Type', 'text/plain')] + start_response('200 OK', response_headers) + return ['Hello!'] + +def main(): + from pyramid.config import Configurator + c = Configurator() + c.scan() + return c |
