summaryrefslogtreecommitdiff
path: root/tests/test_exceptions
diff options
context:
space:
mode:
authorcce <devnull@localhost>2005-12-15 02:06:22 +0000
committercce <devnull@localhost>2005-12-15 02:06:22 +0000
commitc9c44b800d8920466622496fa4b6a5be6dfc8695 (patch)
tree41c382839dd628da556abc5dadd1056182a7fdc1 /tests/test_exceptions
parent74a58aabb3f295e56dff9474310074b7a6d371ef (diff)
downloadpaste-c9c44b800d8920466622496fa4b6a5be6dfc8695.tar.gz
committing an example that worked before the recent change to httpexceptions
Diffstat (limited to 'tests/test_exceptions')
-rw-r--r--tests/test_exceptions/test_httpexceptions.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_exceptions/test_httpexceptions.py b/tests/test_exceptions/test_httpexceptions.py
index 5b0101b..4e958ce 100644
--- a/tests/test_exceptions/test_httpexceptions.py
+++ b/tests/test_exceptions/test_httpexceptions.py
@@ -7,7 +7,7 @@ WSGI Exception Middleware
Regression Test Suite
"""
from paste.httpexceptions import *
-from paste.wsgilib import header_value
+from paste.wsgilib import header_value, raw_interactive
import py
def test_HTTPMove():
@@ -42,6 +42,24 @@ def test_template():
assert '<p>A fun and <b>happy</b> message.</p>' in \
e.html({'ping': 'fun', 'pong': 'happy'})
+def test_iterator_application():
+ """
+ This tests to see that an iterator's exceptions are caught by
+ HTTPExceptionHandler
+ """
+ def basic_found(environ, start_response):
+ raise HTTPFound("/bing/foo")
+ return ['result']
+ app = HTTPExceptionHandler(basic_found)
+ (status, headers, content, errors) = raw_interactive(app)
+ assert '302 Found' == status
+ def iterate_found(environ, start_response):
+ raise HTTPFound("/bing/foo")
+ yield 'result'
+ app = HTTPExceptionHandler(iterate_found)
+ (status, headers, content, errors) = raw_interactive(app)
+ assert '302 Found' == status
+
def test_redapp():
""" check that redirect returns the correct, expected results """
saved = []