Commit e1c1b839 authored by Emmy Vouriot's avatar Emmy Vouriot Committed by Jérome Perrin

str to bytes WIP

parent 6d98a523
......@@ -1518,6 +1518,7 @@ class TestIngestion(IngestionTestCase):
"""
input_script_id = 'Document_getPropertyDictFromContent'
python_code = """from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
information = context.getContentInformation()
......@@ -1526,7 +1527,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
key = k.lower()
if v:
if isinstance(v, unicode):
if six.PY2 and isinstance(v, unicode):
v = v.encode('utf-8')
if key in property_id_list:
if key == 'reference':
......@@ -1573,7 +1574,7 @@ return result
document_to_ingest2 = self.portal.portal_contributions.newContent(
portal_type='File',
filename='toto.txt',
data='Hello World!')
data=b'Hello World!')
document_to_ingest2.publish()
self.tic()
url2 = document_to_ingest2.absolute_url() + '/getData'
......@@ -1599,6 +1600,7 @@ return result
"""
input_script_id = 'Document_getPropertyDictFromContent'
python_code = """from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
information = context.getContentInformation()
......@@ -1607,7 +1609,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
key = k.lower()
if v:
if isinstance(v, unicode):
if six.PY2 and isinstance(v, unicode):
v = v.encode('utf-8')
if key in property_id_list:
if key == 'reference':
......@@ -1651,7 +1653,7 @@ return result
document_to_ingest2 = self.portal.portal_contributions.newContent(
portal_type='File',
filename='toto.txt',
data='Hello World!')
data=b'Hello World!')
document_to_ingest2.publish()
self.tic()
url2 = document_to_ingest2.absolute_url() + '/getData'
......@@ -1709,7 +1711,7 @@ context.setReference(reference)
document_to_ingest2 = self.portal.portal_contributions.newContent(
portal_type='File',
filename='toto.txt',
data='Hello World!')
data=b'Hello World!')
document_to_ingest2.publish()
self.tic()
self.assertEqual(document_to_ingest2.getReference(),
......@@ -1739,6 +1741,7 @@ context.setReference(reference)
"""
input_script_id = 'Document_getPropertyDictFromContent'
python_code = """from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
information = context.getContentInformation()
......@@ -1747,7 +1750,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
key = k.lower()
if v:
if isinstance(v, unicode):
if six.PY2 and isinstance(v, unicode):
v = v.encode('utf-8')
if key in property_id_list:
if key == 'reference':
......@@ -1800,7 +1803,7 @@ return result
document_to_ingest2 = self.portal.portal_contributions.newContent(
portal_type='File',
filename='toto.txt',
data='Hello World!')
data=b'Hello World!')
document_to_ingest2.publish()
self.tic()
self.assertEqual(document_to_ingest2.getReference(),
......@@ -1830,6 +1833,7 @@ return result
"""
input_script_id = 'Document_getPropertyDictFromContent'
python_code = """from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
information = context.getContentInformation()
......@@ -1838,7 +1842,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
key = k.lower()
if v:
if isinstance(v, unicode):
if six.PY2 and isinstance(v, unicode):
v = v.encode('utf-8')
if key in property_id_list:
if key == 'reference':
......@@ -1890,7 +1894,7 @@ return result
document_to_ingest2 = self.portal.portal_contributions.newContent(
portal_type='File',
filename='toto.txt',
data='Hello World!')
data=b'Hello World!')
document_to_ingest2.publish()
self.tic()
self.assertEqual(document_to_ingest2.getReference(),
......
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