summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-04-21 18:03:21 +0200
committerVictor Stinner <victor.stinner@gmail.com>2015-04-21 18:03:21 +0200
commit5757ea3b92078ea14f35f9fd5986b6c6471cf62c (patch)
tree43cc726f1d67d370f18c310deb13bab847eb1859 /tests
parent3950fc1a03ec5d9b6a9078d46b2a19884ab5a9a9 (diff)
downloadpaste-5757ea3b92078ea14f35f9fd5986b6c6471cf62c.tar.gz
Fix test_cgiapp on Python 3
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cgiapp_data/error.cgi2
-rwxr-xr-xtests/cgiapp_data/form.cgi10
-rwxr-xr-xtests/cgiapp_data/ok.cgi9
-rwxr-xr-xtests/cgiapp_data/stderr.cgi12
-rw-r--r--tests/test_cgiapp.py6
5 files changed, 19 insertions, 20 deletions
diff --git a/tests/cgiapp_data/error.cgi b/tests/cgiapp_data/error.cgi
index 5afc9c9..e11c766 100755
--- a/tests/cgiapp_data/error.cgi
+++ b/tests/cgiapp_data/error.cgi
@@ -1,3 +1,3 @@
#!/usr/bin/env python
-print 'hey you!'
+print('hey you!')
diff --git a/tests/cgiapp_data/form.cgi b/tests/cgiapp_data/form.cgi
index 6d2e038..2181998 100755
--- a/tests/cgiapp_data/form.cgi
+++ b/tests/cgiapp_data/form.cgi
@@ -2,11 +2,11 @@
import cgi
-print 'Content-type: text/plain'
-print
+print('Content-type: text/plain')
+print('')
form = cgi.FieldStorage()
-print 'Filename:', form['up'].filename
-print 'Name:', form['name'].value
-print 'Content:', form['up'].file.read()
+print('Filename: %s' % form['up'].filename)
+print('Name: %s' % form['name'].value)
+print('Content: %s' % form['up'].file.read())
diff --git a/tests/cgiapp_data/ok.cgi b/tests/cgiapp_data/ok.cgi
index 8b8eb29..d03f0b9 100755
--- a/tests/cgiapp_data/ok.cgi
+++ b/tests/cgiapp_data/ok.cgi
@@ -1,6 +1,5 @@
#!/usr/bin/env python
-
-print 'Content-type: text/html; charset=UTF-8'
-print 'Status: 200 Okay'
-print
-print 'This is the body'
+print('Content-type: text/html; charset=UTF-8')
+print('Status: 200 Okay')
+print('')
+print('This is the body')
diff --git a/tests/cgiapp_data/stderr.cgi b/tests/cgiapp_data/stderr.cgi
index 89dae0a..d2520b6 100755
--- a/tests/cgiapp_data/stderr.cgi
+++ b/tests/cgiapp_data/stderr.cgi
@@ -1,8 +1,8 @@
#!/usr/bin/env python
-
+from __future__ import print_function
import sys
-print 'Status: 500 Server Error'
-print 'Content-type: text/html'
-print
-print 'There was an error'
-print >> sys.stderr, 'some data on the error'
+print('Status: 500 Server Error')
+print('Content-type: text/html')
+print()
+print('There was an error')
+print('some data on the error', file=sys.stderr)
diff --git a/tests/test_cgiapp.py b/tests/test_cgiapp.py
index 2887271..12cb2be 100644
--- a/tests/test_cgiapp.py
+++ b/tests/test_cgiapp.py
@@ -17,8 +17,8 @@ if sys.platform != 'win32' and not sys.platform.startswith('java'):
def test_form():
app = TestApp(CGIApplication({}, script='form.cgi', path=[data_dir]))
- res = app.post('', params={'name': 'joe'},
- upload_files=[('up', 'file.txt', 'x'*10000)])
+ res = app.post('', params={'name': b'joe'},
+ upload_files=[('up', 'file.txt', b'x'*10000)])
assert 'file.txt' in res
assert 'joe' in res
assert 'x'*10000 in res
@@ -32,5 +32,5 @@ if sys.platform != 'win32' and not sys.platform.startswith('java'):
res = app.get('', expect_errors=True)
assert res.status == 500
assert 'error' in res
- assert 'some data' in res.errors
+ assert b'some data' in res.errors