Commit 379f286b authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

py2/py3: modefnize -f urllib_six product/ERP5OOo/tests/testIngestion.py

parent f9d9dc3d
...@@ -47,10 +47,9 @@ from Products.CMFCore.utils import getToolByName ...@@ -47,10 +47,9 @@ from Products.CMFCore.utils import getToolByName
from zExceptions import BadRequest from zExceptions import BadRequest
import ZPublisher.HTTPRequest import ZPublisher.HTTPRequest
from unittest import expectedFailure from unittest import expectedFailure
import urllib
import urllib2
import six.moves.http_client import six.moves.http_client
import six.moves.urllib.parse import six.moves.urllib.parse, six.moves.urllib.request
import base64 import base64
# test files' home # test files' home
...@@ -2007,7 +2006,7 @@ return result ...@@ -2007,7 +2006,7 @@ return result
uri = '%(protocol)s://%(hostname)s' % url_dict uri = '%(protocol)s://%(hostname)s' % url_dict
push_url = '%s%s/newContent' % (uri, self.portal.portal_contributions.getPath(),) push_url = '%s%s/newContent' % (uri, self.portal.portal_contributions.getPath(),)
request = urllib2.Request(push_url, urllib.urlencode( request = six.moves.urllib.request.Request(push_url, six.moves.urllib.parse.urlencode(
{'data': data, {'data': data,
'filename': filename, 'filename': filename,
'reference': reference, 'reference': reference,
...@@ -2018,7 +2017,7 @@ return result ...@@ -2018,7 +2017,7 @@ return result
}) })
# disable_cookie_login__ is required to force zope to raise Unauthorized (401) # disable_cookie_login__ is required to force zope to raise Unauthorized (401)
# then HTTPDigestAuthHandler can perform HTTP Authentication # then HTTPDigestAuthHandler can perform HTTP Authentication
response = urllib2.urlopen(request) response = six.moves.urllib.request.urlopen(request)
self.assertEqual(response.getcode(), six.moves.http_client.OK) self.assertEqual(response.getcode(), six.moves.http_client.OK)
self.tic() self.tic()
document = self.portal.portal_catalog.getResultValue(portal_type='Spreadsheet', document = self.portal.portal_catalog.getResultValue(portal_type='Spreadsheet',
......
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