diff options
Diffstat (limited to 'tests/test_config_middleware.py')
-rw-r--r-- | tests/test_config_middleware.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_config_middleware.py b/tests/test_config_middleware.py new file mode 100644 index 0000000..56c3d04 --- /dev/null +++ b/tests/test_config_middleware.py @@ -0,0 +1,27 @@ +import pytest + +from paste.deploy.config import ConfigMiddleware + + +class Bug(Exception): + pass + + +def app_with_exception(environ, start_response): + def cont(): + yield b"something" + raise Bug + start_response('200 OK', [('Content-type', 'text/html')]) + return cont() + + +def test_error(): + # This import is conditional due to Paste not yet working on py3k + try: + from paste.fixture import TestApp + except ImportError: + raise SkipTest + + wrapped = ConfigMiddleware(app_with_exception, {'test': 1}) + test_app = TestApp(wrapped) + pytest.raises(Bug, test_app.get, '/') |