summaryrefslogtreecommitdiff
path: root/tests/test_errordocument.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2006-03-03 23:11:45 +0000
committerianb <devnull@localhost>2006-03-03 23:11:45 +0000
commitfc4f7f866be84b96331744c735a0de9a181f32e7 (patch)
treeab8dcc2fbd3feb0aeef6ea1cc805633caee77bac /tests/test_errordocument.py
parent5300b39f6b1b82521bdaff2e94fd35f3c0460a2c (diff)
downloadpaste-fc4f7f866be84b96331744c735a0de9a181f32e7.tar.gz
Rename error_document to errordocument to fit PEP 8 (back-compat commit next)
Diffstat (limited to 'tests/test_errordocument.py')
-rw-r--r--tests/test_errordocument.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_errordocument.py b/tests/test_errordocument.py
new file mode 100644
index 0000000..fab7cca
--- /dev/null
+++ b/tests/test_errordocument.py
@@ -0,0 +1,34 @@
+"""
+Error Document Support Test
++++++++++++++++++++++++++++
+
+WARNING: These tests aren't yet finished. A call to test_ok() using
+not_found_app rather than simple_app currently fails complaining of
+start_response not having been called before content is returned.
+
+This isn't the full story since start_response will have been called
+by the original response but I need advice on how to modify the
+test suite to be able to test this.
+
+I also need to find out how to test that another response was
+correctly requested by the middleware.
+"""
+import os
+import py.test
+from paste.errordocument import forward, custom_forward
+from paste.fixture import *
+
+def simple_app(environ, start_response):
+ start_response("200 OK", [('Content-type', 'text/plain')])
+ return ['requested page returned']
+
+def not_found_app(environ, start_response):
+ start_response("404 Not found", [('Content-type', 'text/plain')])
+ return ['requested page returned']
+
+def test_ok():
+ app = TestApp(forward(simple_app, codes={404:'/error'}))
+ res = app.get('')
+ assert res.header('content-type') == 'text/plain'
+ assert res.full_status == '200 OK'
+ assert 'requested page returned' in res