|
[Webware-checkins] r2242 - in WSGIKit/trunk/wsgikit: . tests
From: <ianb@co...> - 2005-03-26 20:52
|
Author: ianb
Date: 2005-03-26 13:52:10 -0700 (Sat, 26 Mar 2005)
New Revision: 2242
Modified:
WSGIKit/trunk/wsgikit/error_middleware.py
WSGIKit/trunk/wsgikit/tests/test_error_middleware.py
Log:
Fixed some tests
Modified: WSGIKit/trunk/wsgikit/error_middleware.py
===================================================================
--- WSGIKit/trunk/wsgikit/error_middleware.py 2005-03-26 20:52:04 UTC (rev 2241)
+++ WSGIKit/trunk/wsgikit/error_middleware.py 2005-03-26 20:52:10 UTC (rev 2242)
@@ -22,7 +22,7 @@
try:
app_iter = app(environ, detect_start_response)
- return catching_iter(app_iter)
+ return catching_iter(app_iter, environ)
except:
if not started:
start_response('500 Internal Server Error',
@@ -32,7 +32,7 @@
response = exception_handler(sys.exc_info(), environ)
return [response]
- def catching_iter(iter):
+ def catching_iter(iter, environ):
if not iter:
raise StopIteration
error_on_close = False
@@ -87,7 +87,7 @@
def exception_handler(exc_info, environ):
reported = False
exc_data = collector.collect_exception(*exc_info)
- conf = environ['wsgikit.config']
+ conf = environ.get('wsgikit.config', {})
extra_data = ''
if conf.get('error_email'):
rep = reporter.EmailReporter(
Modified: WSGIKit/trunk/wsgikit/tests/test_error_middleware.py
===================================================================
--- WSGIKit/trunk/wsgikit/tests/test_error_middleware.py 2005-03-26 20:52:04 UTC (rev 2241)
+++ WSGIKit/trunk/wsgikit/tests/test_error_middleware.py 2005-03-26 20:52:10 UTC (rev 2242)
@@ -3,7 +3,8 @@
from wsgikit import lint
def do_request(app, expect_status=500):
- res = fake_request(middleware(lint.middleware(app)))
+ res = fake_request(middleware(lint.middleware(app)),
+ **{'wsgikit.config': {'debug': True}})
assert res.status_int == expect_status
return res
@@ -43,13 +44,13 @@
print res
assert 'ValueError: hi' in res
assert 'test_error_middleware.py' in res
- assert 'line 16 in start_response_app' in res
+ assert 'line 17 in <tt>start_response_app</tt>' in res
def test_after_start():
res = do_request(after_start_response_app, 200)
print res
assert 'ValueError: error2' in res
- assert 'line 20' in res
+ assert 'line 21' in res
def test_iter_app():
res = do_request(iter_app, 200)
|
| Thread | Author | Date |
|---|---|---|
| [Webware-checkins] r2242 - in WSGIKit/trunk/wsgikit: . tests | <ianb@co...> |