Commit 4f477d68 authored by Jérome Perrin's avatar Jérome Perrin

ERP5TypeTestCase: backport Zope pull request 1059

This is a simplified version that works well enough for python 2.
For Zope 4 and python 3 we are considering reusing publish.
parent bd7a8fb7
Pipeline #23929 failed with stage
in 0 seconds
...@@ -22,6 +22,7 @@ import urllib ...@@ -22,6 +22,7 @@ import urllib
import ConfigParser import ConfigParser
from contextlib import contextmanager from contextlib import contextmanager
from six.moves import cStringIO as StringIO from six.moves import cStringIO as StringIO
from six.moves.urllib.parse import unquote_to_bytes
from cPickle import dumps from cPickle import dumps
from glob import glob from glob import glob
from hashlib import md5 from hashlib import md5
...@@ -784,13 +785,14 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase): ...@@ -784,13 +785,14 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
env['HTTP_ACCEPT_CHARSET'] = request['HTTP_ACCEPT_CHARSET'] env['HTTP_ACCEPT_CHARSET'] = request['HTTP_ACCEPT_CHARSET']
env['REQUEST_METHOD'] = request_method env['REQUEST_METHOD'] = request_method
p = path.split('?') query = ''
if len(p) == 1: if '?' in path:
env['PATH_INFO'] = p[0] path, query = path.split("?", 1)
elif len(p) == 2: if six.PY2:
[env['PATH_INFO'], env['QUERY_STRING']] = p env['PATH_INFO'] = unquote_to_bytes(path)
else: else:
raise TypeError('') env['PATH_INFO'] = unquote_to_bytes(path).decode('latin-1')
env['QUERY_STRING'] = query
if basic: if basic:
assert not user, (basic, user) assert not user, (basic, user)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment