diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-04-22 00:21:13 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-04-22 00:21:13 +0200 |
commit | 8d28bef1dc52d1488d5a3cfded02d19aa2fe11fe (patch) | |
tree | ca84504877095fbe7b19537469d3c80522150d5d /tests | |
parent | b38b4b27954b0f13e36c39650d66a7287a1ed039 (diff) | |
download | paste-8d28bef1dc52d1488d5a3cfded02d19aa2fe11fe.tar.gz |
Port test_errordocument on Python 3
On Python 3, encode body to UTF-8
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_errordocument.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test_errordocument.py b/tests/test_errordocument.py index c284b93..efeae61 100644 --- a/tests/test_errordocument.py +++ b/tests/test_errordocument.py @@ -4,11 +4,11 @@ from paste.recursive import RecursiveMiddleware def simple_app(environ, start_response): start_response("200 OK", [('Content-type', 'text/plain')]) - return ['requested page returned'] + return [b'requested page returned'] def not_found_app(environ, start_response): start_response("404 Not found", [('Content-type', 'text/plain')]) - return ['requested page returned'] + return [b'requested page returned'] def test_ok(): app = TestApp(simple_app) @@ -20,10 +20,10 @@ def test_ok(): def error_docs_app(environ, start_response): if environ['PATH_INFO'] == '/not_found': start_response("404 Not found", [('Content-type', 'text/plain')]) - return ['Not found'] + return [b'Not found'] elif environ['PATH_INFO'] == '/error': start_response("200 OK", [('Content-type', 'text/plain')]) - return ['Page not found'] + return [b'Page not found'] else: return simple_app(environ, start_response) @@ -68,7 +68,7 @@ def auth_docs_app(environ, start_response): return auth_required_app(environ, start_response) elif environ['PATH_INFO'] == '/auth_doc': start_response("200 OK", [('Content-type', 'text/html')]) - return ['<html>Login!</html>'] + return [b'<html>Login!</html>'] else: return simple_app(environ, start_response) @@ -80,7 +80,7 @@ def test_auth_docs_app(): res = app.get('/auth', status=401) assert res.header('content-type') == 'text/html' assert res.header('www-authenticate') == 'Basic realm="Foo"' - assert res.body == '<html>Login!</html>' + assert res.body == b'<html>Login!</html>' def test_bad_error(): def app(environ, start_response): |