summaryrefslogtreecommitdiff
path: root/tests/urlparser_data
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-04-21 15:57:20 +0200
committerVictor Stinner <victor.stinner@gmail.com>2015-04-21 15:57:20 +0200
commitf3fd444b0bc18e95d08c88567d9d8ed17346027d (patch)
treea92c992c3c6e428191c6687bafe618ef060ac9ca /tests/urlparser_data
parent75646c0540381741943935a15c23ab1a226043c2 (diff)
downloadpaste-f3fd444b0bc18e95d08c88567d9d8ed17346027d.tar.gz
Fix urlparser tests on Python 3
HTTP body must be bytes
Diffstat (limited to 'tests/urlparser_data')
-rw-r--r--tests/urlparser_data/hook/app.py8
-rw-r--r--tests/urlparser_data/hook/index.py7
-rw-r--r--tests/urlparser_data/not_found/simple/__init__.py2
-rw-r--r--tests/urlparser_data/not_found/user/list.py7
-rw-r--r--tests/urlparser_data/python/simpleapp.py3
-rw-r--r--tests/urlparser_data/python/stream.py6
-rw-r--r--tests/urlparser_data/python/sub/simpleapp.py4
7 files changed, 24 insertions, 13 deletions
diff --git a/tests/urlparser_data/hook/app.py b/tests/urlparser_data/hook/app.py
index a96866c..1a98013 100644
--- a/tests/urlparser_data/hook/app.py
+++ b/tests/urlparser_data/hook/app.py
@@ -1,5 +1,9 @@
+import six
+
def application(environ, start_response):
start_response('200 OK', [('Content-type', 'text/html')])
- return ['user: %s' % environ['app.user']]
-
+ body = 'user: %s' % environ['app.user']
+ if six.PY3:
+ body = body.encode('ascii')
+ return [body]
diff --git a/tests/urlparser_data/hook/index.py b/tests/urlparser_data/hook/index.py
index 49e89f0..92f3d66 100644
--- a/tests/urlparser_data/hook/index.py
+++ b/tests/urlparser_data/hook/index.py
@@ -1,4 +1,9 @@
+import six
+
def application(environ, start_response):
start_response('200 OK', [('Content-type', 'text/html')])
- return ['index: %s' % environ['app.user']]
+ body = 'index: %s' % environ['app.user']
+ if six.PY3:
+ body = body.encode('ascii')
+ return [body]
diff --git a/tests/urlparser_data/not_found/simple/__init__.py b/tests/urlparser_data/not_found/simple/__init__.py
index f1e7faa..7186daa 100644
--- a/tests/urlparser_data/not_found/simple/__init__.py
+++ b/tests/urlparser_data/not_found/simple/__init__.py
@@ -1,3 +1,3 @@
def not_found_hook(environ, start_response):
start_response('200 OK', [('Content-type', 'text/plain')])
- return ['not found']
+ return [b'not found']
diff --git a/tests/urlparser_data/not_found/user/list.py b/tests/urlparser_data/not_found/user/list.py
index f6228f0..fd7482f 100644
--- a/tests/urlparser_data/not_found/user/list.py
+++ b/tests/urlparser_data/not_found/user/list.py
@@ -1,3 +1,8 @@
+import six
+
def application(environ, start_response):
start_response('200 OK', [('Content-type', 'text/plain')])
- return ['user: %s' % environ.get('app.user')]
+ body = 'user: %s' % environ.get('app.user')
+ if six.PY3:
+ body = body.encode('ascii')
+ return [body]
diff --git a/tests/urlparser_data/python/simpleapp.py b/tests/urlparser_data/python/simpleapp.py
index e13bb3e..7a36ce9 100644
--- a/tests/urlparser_data/python/simpleapp.py
+++ b/tests/urlparser_data/python/simpleapp.py
@@ -1,6 +1,5 @@
def application(environ, start_response):
start_response('200 OK', [('Content-type', 'text/html'),
('test-header', 'TEST!')])
- return ['test1']
-
+ return [b'test1']
diff --git a/tests/urlparser_data/python/stream.py b/tests/urlparser_data/python/stream.py
index 121b4d1..e81fd1c 100644
--- a/tests/urlparser_data/python/stream.py
+++ b/tests/urlparser_data/python/stream.py
@@ -1,7 +1,7 @@
def stream():
def app(environ, start_response):
writer = start_response('200 OK', [('Content-type', 'text/html')])
- writer('te')
- writer('st')
- return ['2']
+ writer(b'te')
+ writer(b'st')
+ return [b'2']
return app
diff --git a/tests/urlparser_data/python/sub/simpleapp.py b/tests/urlparser_data/python/sub/simpleapp.py
index ac83a56..88bd975 100644
--- a/tests/urlparser_data/python/sub/simpleapp.py
+++ b/tests/urlparser_data/python/sub/simpleapp.py
@@ -1,6 +1,4 @@
def application(environ, start_response):
start_response('200 OK', [('Content-type', 'text/html'),
('test-header', 'TEST!')])
- return ['subsimple']
-
-
+ return [b'subsimple']