Commit 3a0a5eec authored by Xiaowu Zhang's avatar Xiaowu Zhang

ors_wendelin_test: test

parent 68776257
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Page" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_ors_example_log</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -19,18 +19,7 @@ ...@@ -19,18 +19,7 @@
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
# #
############################################################################## ##############################################################################
from cStringIO import StringIO
import base64
import numpy as np
import string
import random
import struct
import urllib
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from wendelin.bigarray.array_zodb import ZBigArray
class ORSWendelinTest(ERP5TypeTestCase): class ORSWendelinTest(ERP5TypeTestCase):
...@@ -41,8 +30,48 @@ class ORSWendelinTest(ERP5TypeTestCase): ...@@ -41,8 +30,48 @@ class ORSWendelinTest(ERP5TypeTestCase):
def getTitle(self): def getTitle(self):
return "ORS Wendelin Test" return "ORS Wendelin Test"
def test_01_dummy(self): def afterSetUp(self):
""" test_data_acquisition_unit = getattr(self.portal.data_acquisition_unit_module, 'test_data_acquisition_unit', None)
Test that we do not load pickles when converting encoded wendelin data to numpy. if not test_data_acquisition_unit:
""" test_data_acquisition_unit = self.portal.data_acquisition_unit_module.newContent(
portal_type='Data Acquisition Unit',
id='test_data_acquisition_unit',
reference='test_data_acquisition_unit')
if test_data_acquisition_unit.getValidationState() != 'validated':
test_data_acquisition_unit.validate()
data_stream = self._getDataStream(test_data_acquisition_unit)
if data_stream:
data_stream.setData(None)
self.test_data_acquisition_unit = test_data_acquisition_unit
self.test_ors_example_log = self.portal.web_page_module.test_ors_example_log
self.tic()
def _getDataStream(self, obj):
for line in obj.getAggregateRelatedValueList(portal_type='Data Ingestion Line'):
data_stream = line.getAggregateValue(portal_type='Data Stream')
if data_stream:
return data_stream
def _ingestData(self, reference, data):
request = self.portal.REQUEST
request.environ["REQUEST_METHOD"] = 'POST'
request.set('reference', reference)
request.set('data_chunk', data)
self.portal.portal_ingestion_policies.ors_ingestion.ingest()
self.tic()
def test_ingestion(self):
data_supply = self.test_data_acquisition_unit.DataAcquisitionUnit_createORSDataSupply(batch=1)
self.tic()
self.assertEqual(data_supply.getValidationState(), 'validated')
self._ingestData(data_supply.getReference(), self.test_ors_example_log.getTextContent())
self.tic()
data_stream = self._getDataStream(self.test_data_acquisition_unit)
self.assertTrue(data_stream.getData() is not None)
def test_transformation(self):
pass pass
\ No newline at end of file
...@@ -45,16 +45,7 @@ ...@@ -45,16 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 23, 0: Unused StringIO imported from cStringIO (unused-import)</string>
<string>W: 24, 0: Unused import base64 (unused-import)</string>
<string>W: 25, 0: Unused numpy imported as np (unused-import)</string>
<string>W: 26, 0: Unused import string (unused-import)</string>
<string>W: 27, 0: Unused import random (unused-import)</string>
<string>W: 28, 0: Unused import struct (unused-import)</string>
<string>W: 29, 0: Unused import urllib (unused-import)</string>
<string>W: 33, 0: Unused ZBigArray imported from wendelin.bigarray.array_zodb (unused-import)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
web_page_module/test_ors_example_log
\ 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