Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
erp5
Commits
18b72af2
Commit
18b72af2
authored
Jul 31, 2023
by
Emmy Vouriot
Committed by
Jérome Perrin
Feb 01, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
str to bytes WIP
parent
2ddcae05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
product/ERP5OOo/tests/testIngestion.py
product/ERP5OOo/tests/testIngestion.py
+13
-9
No files found.
product/ERP5OOo/tests/testIngestion.py
View file @
18b72af2
...
@@ -1525,6 +1525,7 @@ class TestIngestion(IngestionTestCase):
...
@@ -1525,6 +1525,7 @@ class TestIngestion(IngestionTestCase):
"""
"""
input_script_id
=
'Document_getPropertyDictFromContent'
input_script_id
=
'Document_getPropertyDictFromContent'
python_code
=
"""from Products.CMFCore.utils import getToolByName
python_code
=
"""from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
portal = context.getPortalObject()
information = context.getContentInformation()
information = context.getContentInformation()
...
@@ -1533,7 +1534,7 @@ property_id_list = context.propertyIds()
...
@@ -1533,7 +1534,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
for k, v in information.items():
key = k.lower()
key = k.lower()
if v:
if v:
if isinstance(v, unicode):
if
six.PY2 and
isinstance(v, unicode):
v = v.encode('utf-8')
v = v.encode('utf-8')
if key in property_id_list:
if key in property_id_list:
if key == 'reference':
if key == 'reference':
...
@@ -1580,7 +1581,7 @@ return result
...
@@ -1580,7 +1581,7 @@ return result
document_to_ingest2
=
self
.
portal
.
portal_contributions
.
newContent
(
document_to_ingest2
=
self
.
portal
.
portal_contributions
.
newContent
(
portal_type
=
'File'
,
portal_type
=
'File'
,
filename
=
'toto.txt'
,
filename
=
'toto.txt'
,
data
=
'Hello World!'
)
data
=
b
'Hello World!'
)
document_to_ingest2
.
publish
()
document_to_ingest2
.
publish
()
self
.
tic
()
self
.
tic
()
url2
=
document_to_ingest2
.
absolute_url
()
+
'/getData'
url2
=
document_to_ingest2
.
absolute_url
()
+
'/getData'
...
@@ -1606,6 +1607,7 @@ return result
...
@@ -1606,6 +1607,7 @@ return result
"""
"""
input_script_id
=
'Document_getPropertyDictFromContent'
input_script_id
=
'Document_getPropertyDictFromContent'
python_code
=
"""from Products.CMFCore.utils import getToolByName
python_code
=
"""from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
portal = context.getPortalObject()
information = context.getContentInformation()
information = context.getContentInformation()
...
@@ -1614,7 +1616,7 @@ property_id_list = context.propertyIds()
...
@@ -1614,7 +1616,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
for k, v in information.items():
key = k.lower()
key = k.lower()
if v:
if v:
if isinstance(v, unicode):
if
six.PY2 and
isinstance(v, unicode):
v = v.encode('utf-8')
v = v.encode('utf-8')
if key in property_id_list:
if key in property_id_list:
if key == 'reference':
if key == 'reference':
...
@@ -1658,7 +1660,7 @@ return result
...
@@ -1658,7 +1660,7 @@ return result
document_to_ingest2
=
self
.
portal
.
portal_contributions
.
newContent
(
document_to_ingest2
=
self
.
portal
.
portal_contributions
.
newContent
(
portal_type
=
'File'
,
portal_type
=
'File'
,
filename
=
'toto.txt'
,
filename
=
'toto.txt'
,
data
=
'Hello World!'
)
data
=
b
'Hello World!'
)
document_to_ingest2
.
publish
()
document_to_ingest2
.
publish
()
self
.
tic
()
self
.
tic
()
url2
=
document_to_ingest2
.
absolute_url
()
+
'/getData'
url2
=
document_to_ingest2
.
absolute_url
()
+
'/getData'
...
@@ -1716,7 +1718,7 @@ context.setReference(reference)
...
@@ -1716,7 +1718,7 @@ context.setReference(reference)
document_to_ingest2
=
self
.
portal
.
portal_contributions
.
newContent
(
document_to_ingest2
=
self
.
portal
.
portal_contributions
.
newContent
(
portal_type
=
'File'
,
portal_type
=
'File'
,
filename
=
'toto.txt'
,
filename
=
'toto.txt'
,
data
=
'Hello World!'
)
data
=
b
'Hello World!'
)
document_to_ingest2
.
publish
()
document_to_ingest2
.
publish
()
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
document_to_ingest2
.
getReference
(),
self
.
assertEqual
(
document_to_ingest2
.
getReference
(),
...
@@ -1746,6 +1748,7 @@ context.setReference(reference)
...
@@ -1746,6 +1748,7 @@ context.setReference(reference)
"""
"""
input_script_id
=
'Document_getPropertyDictFromContent'
input_script_id
=
'Document_getPropertyDictFromContent'
python_code
=
"""from Products.CMFCore.utils import getToolByName
python_code
=
"""from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
portal = context.getPortalObject()
information = context.getContentInformation()
information = context.getContentInformation()
...
@@ -1754,7 +1757,7 @@ property_id_list = context.propertyIds()
...
@@ -1754,7 +1757,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
for k, v in information.items():
key = k.lower()
key = k.lower()
if v:
if v:
if isinstance(v, unicode):
if
six.PY2 and
isinstance(v, unicode):
v = v.encode('utf-8')
v = v.encode('utf-8')
if key in property_id_list:
if key in property_id_list:
if key == 'reference':
if key == 'reference':
...
@@ -1807,7 +1810,7 @@ return result
...
@@ -1807,7 +1810,7 @@ return result
document_to_ingest2
=
self
.
portal
.
portal_contributions
.
newContent
(
document_to_ingest2
=
self
.
portal
.
portal_contributions
.
newContent
(
portal_type
=
'File'
,
portal_type
=
'File'
,
filename
=
'toto.txt'
,
filename
=
'toto.txt'
,
data
=
'Hello World!'
)
data
=
b
'Hello World!'
)
document_to_ingest2
.
publish
()
document_to_ingest2
.
publish
()
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
document_to_ingest2
.
getReference
(),
self
.
assertEqual
(
document_to_ingest2
.
getReference
(),
...
@@ -1837,6 +1840,7 @@ return result
...
@@ -1837,6 +1840,7 @@ return result
"""
"""
input_script_id
=
'Document_getPropertyDictFromContent'
input_script_id
=
'Document_getPropertyDictFromContent'
python_code
=
"""from Products.CMFCore.utils import getToolByName
python_code
=
"""from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
portal = context.getPortalObject()
information = context.getContentInformation()
information = context.getContentInformation()
...
@@ -1845,7 +1849,7 @@ property_id_list = context.propertyIds()
...
@@ -1845,7 +1849,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
for k, v in information.items():
key = k.lower()
key = k.lower()
if v:
if v:
if isinstance(v, unicode):
if
six.PY2 and
isinstance(v, unicode):
v = v.encode('utf-8')
v = v.encode('utf-8')
if key in property_id_list:
if key in property_id_list:
if key == 'reference':
if key == 'reference':
...
@@ -1897,7 +1901,7 @@ return result
...
@@ -1897,7 +1901,7 @@ return result
document_to_ingest2
=
self
.
portal
.
portal_contributions
.
newContent
(
document_to_ingest2
=
self
.
portal
.
portal_contributions
.
newContent
(
portal_type
=
'File'
,
portal_type
=
'File'
,
filename
=
'toto.txt'
,
filename
=
'toto.txt'
,
data
=
'Hello World!'
)
data
=
b
'Hello World!'
)
document_to_ingest2
.
publish
()
document_to_ingest2
.
publish
()
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
document_to_ingest2
.
getReference
(),
self
.
assertEqual
(
document_to_ingest2
.
getReference
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment