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

str to bytes WIP

parent a1744f6e
......@@ -1533,6 +1533,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()
......@@ -1541,7 +1542,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':
......@@ -1588,7 +1589,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'
......@@ -1614,6 +1615,7 @@ return result
"""
input_script_id = 'Document_getPropertyDictFromContent'
python_code = """from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
information = context.getContentInformation()
......@@ -1622,7 +1624,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':
......@@ -1666,7 +1668,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'
......@@ -1724,7 +1726,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(),
......@@ -1754,6 +1756,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()
......@@ -1762,7 +1765,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':
......@@ -1815,7 +1818,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(),
......@@ -1845,6 +1848,7 @@ return result
"""
input_script_id = 'Document_getPropertyDictFromContent'
python_code = """from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
information = context.getContentInformation()
......@@ -1853,7 +1857,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':
......@@ -1905,7 +1909,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