summaryrefslogtreecommitdiff
path: root/tests/test_exceptions/test_error_middleware.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-11-05 03:11:40 +0000
committerianb <devnull@localhost>2005-11-05 03:11:40 +0000
commitaf58a3a3c216bb5ee9fd8a04d613d72f0b6c0aba (patch)
tree5f41240e65041ecef3df7234e1eb7e3bc09dba72 /tests/test_exceptions/test_error_middleware.py
parent6e0a0c1ca9ea0b81c40d7bb5ddf98edb7c4acd74 (diff)
downloadpaste-af58a3a3c216bb5ee9fd8a04d613d72f0b6c0aba.tar.gz
Fixed case when the code could not be highlighted because it is too invalid; fixed tests that broke due to change of output
Diffstat (limited to 'tests/test_exceptions/test_error_middleware.py')
-rw-r--r--tests/test_exceptions/test_error_middleware.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/test_exceptions/test_error_middleware.py b/tests/test_exceptions/test_error_middleware.py
index c7f6370..5b1df26 100644
--- a/tests/test_exceptions/test_error_middleware.py
+++ b/tests/test_exceptions/test_error_middleware.py
@@ -2,6 +2,11 @@ from paste.fixture import *
from paste.exceptions.errormiddleware import ErrorMiddleware
from paste import lint
+def strip_html(s):
+ s = re.sub('<.*?>', '', s)
+ s = s.replace('&nbsp;', ' ').replace('&lt;', '<').replace('&gt;', '>')
+ return s
+
def do_request(app, expect_status=500):
app = lint.middleware(app)
app = ErrorMiddleware(app, {}, debug=True)
@@ -57,25 +62,28 @@ def yielder(args):
def test_makes_exception():
res = do_request(bad_app)
- print res
assert '<html' in res
+ res = strip_html(str(res))
+ print res
assert 'bad_app() takes no arguments (2 given' in res
assert 'iterator = application(environ, start_response_wrapper)' in res
- assert 'lint.py' in res
- assert 'errormiddleware.py' in res
+ assert 'paste.lint' in res
+ assert 'paste.exceptions.errormiddleware' in res
def test_start_res():
res = do_request(start_response_app)
+ res = strip_html(str(res))
print res
assert 'ValueError: hi' in res
- assert 'test_error_middleware.py' in res
- assert 'line 38 in <tt>start_response_app</tt>' in res
+ assert 'test_error_middleware' in res
+ assert ':43 in start_response_app' in res
def test_after_start():
res = do_request(after_start_response_app, 200)
+ res = strip_html(str(res))
print res
assert 'ValueError: error2' in res
- assert 'line 42' in res
+ assert ':47' in res
def test_iter_app():
res = do_request(iter_app, 200)