Commit f8eeb860 authored by Levin Zimmermann's avatar Levin Zimmermann

erp5_wendelin: Add test for Index*Sequence in restricted python

parent e1e5860a
...@@ -59,7 +59,7 @@ class Test(ERP5TypeTestCase): ...@@ -59,7 +59,7 @@ class Test(ERP5TypeTestCase):
def getTitle(self): def getTitle(self):
return "Wendelin Test" return "Wendelin Test"
def createAndRunScript(self, code, expected): def createAndRunScript(self, code, expected=None):
# we do not care the script name for security test thus use uuid1 # we do not care the script name for security test thus use uuid1
name = str(uuid.uuid1()) name = str(uuid.uuid1())
script_container = self.portal.portal_skins.custom script_container = self.portal.portal_skins.custom
...@@ -602,4 +602,20 @@ result = [x for x in ingestion_policy.unpackLazy('b"\x93\x01\x02\x03"')] ...@@ -602,4 +602,20 @@ result = [x for x in ingestion_policy.unpackLazy('b"\x93\x01\x02\x03"')]
return result return result
""".format(ingestion_policy_id) """.format(ingestion_policy_id)
self.createAndRunScript(code, [98, 34, [1, 2, 3], 34]) self.createAndRunScript(code, [98, 34, [1, 2, 3], 34])
\ No newline at end of file
def test_14_IndexSequenceInRestrictedPython(self):
"""
Ensure its possible to iterate over return values of DataBucketStream methods
in restricted python.
"""
code = r"""
data_bucket_stream = context.portal_catalog.data_stream_module.newContent(
portal_type='Data Bucket Stream'
)
data_bucket_stream.insertBucket(1, "1" * 100000)
result = [x for x in data_bucket_stream.getBucketIndexKeySequenceByIndex()]
"""
self.createAndRunScript(code)
\ No newline at end of file
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