Commit 227402e3 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_dms: Migrate ExternalSource and erp5_dms-related Unit Tests from filesystem.

parent 431f8484
Pipeline #9597 failed with stage
......@@ -32,7 +32,7 @@
import unittest
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5OOo.tests.testDms import makeFileUpload
from erp5.component.test.testDms import makeFileUpload
class TestERP5Discussion(ERP5TypeTestCase):
......@@ -59,7 +59,7 @@ class TestERP5Discussion(ERP5TypeTestCase):
'erp5_jquery',
'erp5_discussion', )
def login(self):
def login(self, *args, **kw):
uf = self.getPortal().acl_users
uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], [])
user = uf.getUserById(self.manager_username).__of__(uf)
......@@ -87,7 +87,7 @@ class TestERP5Discussion(ERP5TypeTestCase):
def test_01_createDiscussionThread(self):
"""Create a new discussion thread"""
self.stepCreateThread();
self.stepCreateThread()
self.tic()
def test_02_createDiscussionPost(self):
......@@ -143,8 +143,8 @@ class TestERP5Discussion(ERP5TypeTestCase):
self.assertEqual(0, len(attachment_list))
# check attachment creation
file = makeFileUpload('TEST-en-002.doc')
web_section1.WebSection_createNewDiscussionThread('test1-new-with-attachment', 'test1 body', file=file)
file_ = makeFileUpload('TEST-en-002.doc')
web_section1.WebSection_createNewDiscussionThread('test1-new-with-attachment', 'test1 body', file=file_)
discussion_thread, = [x for x in self.portal.discussion_thread_module.objectValues() \
if x.getId() not in discussion_thread_id_set]
discussion_thread_id_set.add(discussion_thread.getId())
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testERP5Discussion</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testERP5Discussion</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testERP5Discussion</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test.erp5.testERP5Discussion
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_ingestion_mysql_innodb_catalog
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Document Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ExternalSource</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.ExternalSource</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.ExternalSource</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Document Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testDms</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5OOo.tests.testDms</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testDms</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -28,7 +28,7 @@
##############################################################################
import unittest
from testDms import TestDocument
from erp5.component.test.testDms import TestDocument
from Products.ERP5Type.tests.ERP5TypeTestCase import _getPersistentMemcachedServerDict
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testDmsWithFlare</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5OOo.tests.testDmsWithFlare</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testDmsWithFlare</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -68,7 +68,8 @@ gg==''')
def makeFilePath(name):
return os.path.join(os.path.dirname(__file__), 'test_data', name)
from Products.ERP5 import tests
return os.path.join(tests.__path__[0], 'test_data', name)
def makeFileUpload(name, as_name=None):
if as_name is None:
......@@ -1319,7 +1320,7 @@ return True
("image/png", "", pngmessage, png, XSMALL_PNG_IMAGE_ICON_DATA),
("image/png", "png", svgtopngmessage, svg, None),
]:
__traceback_info__ = (content_type, "?format=" + ext)
__traceback_info__ = (content_type, "?format=" + ext) # pylint: disable=unused-variable
self.assertEqual(
message.get("Content-Location"),
obj.absolute_url() + "?format=" + ext,
......@@ -1479,7 +1480,7 @@ return True
image_module = self.portal.getDefaultModule(portal_type="Image")
page = web_page_module.newContent(portal_type="Web Page")
text_content_list = ["<p>Hello</p>"]
for i in range(0, 1000, 5):
for _ in range(0, 1000, 5):
svg = image_module.newContent(portal_type="Image")
svg.edit(content_type="image/svg+xml", data=XSMALL_SVG_IMAGE_ICON_DATA)
svg.publish()
......@@ -1505,7 +1506,7 @@ return True
image_module = self.portal.getDefaultModule(portal_type="Image")
page = web_page_module.newContent(portal_type="Web Page")
text_content_list = ["<p>Hello</p>"]
for i in range(0, 1000, 5):
for _ in range(0, 1000, 5):
svg = image_module.newContent(portal_type="Image")
svg.edit(content_type="image/svg+xml", data=XSMALL_SVG_IMAGE_ICON_DATA)
svg.publish()
......@@ -1603,7 +1604,7 @@ return True
def test_WebPageImplicitSuccessorValueList(self):
# Test init part
# XXX use web site domain properties instead of @customScript
web_site = self.setupWebSite()
self.setupWebSite()
web_page_module = self.portal.getDefaultModule(portal_type="Web Page")
image_module = self.portal.getDefaultModule(portal_type="Image")
img_list = []
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testERP5WebWithDms</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testERP5WebWithDms</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testERP5WebWithDms</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testOOoConversionCache</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5OOo.tests.testOOoConversionCache</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testOOoConversionCache</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -26,7 +26,7 @@
##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5OOo.tests.testDms import makeFileUpload
from erp5.component.test.testDms import makeFileUpload
from Products.ERP5Form.PreferenceTool import Priority
......@@ -63,12 +63,12 @@ class TestOOoConversionServerRetry(ERP5TypeTestCase):
self.retry_count = 2
def getDefaultSystemPreference(self):
id = 'default_system_preference'
id_ = 'default_system_preference'
tool = self.getPreferenceTool()
try:
pref = tool[id]
pref = tool[id_]
except KeyError:
pref = tool.newContent(id, 'System Preference')
pref = tool.newContent(id_, 'System Preference')
pref.setPriority(Priority.SITE)
pref.enable()
return pref
......@@ -80,9 +80,9 @@ class TestOOoConversionServerRetry(ERP5TypeTestCase):
self.tic()
filename = 'monochrome_sample.tiff'
file = makeFileUpload(filename)
file_ = makeFileUpload(filename)
document = self.portal.document_module.newContent(portal_type='Text')
document.edit(file = file)
document.edit(file = file_)
message = document.Document_tryToConvertToBaseFormat()
self.assertEqual(message.count('Error converting document to base format'), 1)
......@@ -95,8 +95,8 @@ class TestOOoConversionServerRetry(ERP5TypeTestCase):
system_pref.setPreferredDocumentConversionServerUrlList(['https://broken.url'])
self.tic()
filename = 'TEST-en-002.doc'
file = makeFileUpload(filename)
document = self.portal.portal_contributions.newContent(file=file)
file_ = makeFileUpload(filename)
document = self.portal.portal_contributions.newContent(file=file_)
message = document.Document_tryToConvertToBaseFormat()
self.assertEqual(message.count('broken.url: Connection refused'), self.retry_count + 1)
......@@ -110,8 +110,8 @@ class TestOOoConversionServerRetry(ERP5TypeTestCase):
system_pref.setPreferredOoodocServerTimeout(1)
self.tic()
filename = 'TEST-en-002.doc'
file = makeFileUpload(filename)
document = self.portal.portal_contributions.newContent(file=file)
file_ = makeFileUpload(filename)
document = self.portal.portal_contributions.newContent(file=file_)
message = document.Document_tryToConvertToBaseFormat()
if 'Socket Error: SSLError' in message:
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testOOoConversionServerRetry</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5OOo.tests.testOOoConversionServerRetry</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testOOoConversionServerRetry</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
document.erp5.ExternalSource
document.erp5.PDFDocument
\ No newline at end of file
test.erp5.testDms
test.erp5.testDmsWithFlare
test.erp5.testERP5WebWithDms
test.erp5.testOOoConversionCache
test.erp5.testOOoConversionServerRetry
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_ingestion_mysql_innodb_catalog
\ No newline at end of file
......@@ -28,15 +28,13 @@
##############################################################################
import unittest
from testDms import TestDocument, makeFileUpload
from erp5.component.test.testDms import TestDocument, makeFileUpload
class TestDocumentWithPreConversion(TestDocument):
"""
Test basic document - related operations
with Flare
"""
business_template_list = TestDocument.business_template_list + ["erp5_dms_conversion_catalog"]
def getTitle(self):
return "DMS with Preconversion"
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testDmsWithPreConversion</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5OOo.tests.testDmsWithPreConversion</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testDmsWithPreConversion</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test.erp5.testDmsWithPreConversion
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_dms
\ No newline at end of file
......@@ -30,7 +30,7 @@
from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.ExternalSource import ExternalSource
from erp5.component.document.ExternalSource import ExternalSource
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Cache import transactional_cached
......
......@@ -31,8 +31,7 @@ import unittest
from unittest import expectedFailure
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Base import TempBase
from Products.ERP5OOo.tests.testDms import makeFileUpload
from Products.ERP5OOo.tests.testDms import TestDocumentMixin
from erp5.component.test.testDms import makeFileUpload, TestDocumentMixin
def _getGadgetInstanceUrlFromKnowledgePad(knowledge_pad, gadget):
""" Get Knowledge Box's relative URL specialising a gadget in a Knowledge Pad."""
......@@ -65,7 +64,6 @@ class TestKMMixIn(TestDocumentMixin):
def afterSetUp(self):
self.login()
portal = self.getPortal()
self.website = self.setupWebSite(skin_selection_name='KM',
container_layout='erp5_km_minimal_layout',
content_layout='erp5_km_minimal_content_layout',
......@@ -87,7 +85,7 @@ class TestKMMixIn(TestDocumentMixin):
self.tic()
return website
def login(self):
def login(self, *args, **kw):
uf = self.getPortal().acl_users
uf._doAddUser('ivan', '', ['Manager'], [])
uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], [])
......@@ -230,14 +228,14 @@ class TestKM(TestKMMixIn):
mode='web_section',
default_pad_group = pad_group)
self.tic()
base_websection_pad, websection_pads = \
base_websection_pad, _ = \
websection.ERP5Site_getActiveKnowledgePadForUser(default_pad_group = pad_group)
# Check stick
websection.WebSection_stickKnowledgePad(
base_websection_pad.getRelativeUrl(), '')
self.tic()
current_websection_pad, websection_pads = \
current_websection_pad, _ = \
websection.ERP5Site_getActiveKnowledgePadForUser(mode='web_section',
default_pad_group = pad_group )
self.assertNotEqual(base_websection_pad.getObject(),
......@@ -245,7 +243,7 @@ class TestKM(TestKMMixIn):
# check unstick
websection.WebSection_unStickKnowledgePad(current_websection_pad.getRelativeUrl(), '')
current_websection_pad, websection_pads = \
current_websection_pad, _ = \
websection.ERP5Site_getActiveKnowledgePadForUser(default_pad_group = pad_group)
self.assertEqual(base_websection_pad.getObject(),
current_websection_pad.getObject())
......@@ -820,7 +818,6 @@ class TestKM(TestKMMixIn):
def test_17AddGadgets(self):
""" Check Latest Content Gadgets """
portal = self.getPortal()
portal_selections = portal.portal_selections
km_my_documents_gadget = portal.portal_gadgets.km_my_documents
km_my_contacts_gadget = portal.portal_gadgets.km_my_contacts
......@@ -854,7 +851,6 @@ class TestKM(TestKMMixIn):
# change to KM skins which is defined in erp5_km
self.changeSkin('KM')
assigned_member_list = websection.WebSection_searchAssignmentList(portal_type='Assignment')
self.assertEqual(0, len(websection.WebSection_searchAssignmentList(portal_type='Assignment')))
project = portal.project_module.newContent(portal_type='Project', \
id='test_project')
......@@ -868,8 +864,8 @@ class TestKM(TestKMMixIn):
person = portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type= 'Assignment',
destination_project = project.getRelativeUrl())
another_assignment = person.newContent(portal_type= 'Assignment',
destination_project = another_project.getRelativeUrl())
person.newContent(portal_type= 'Assignment',
destination_project = another_project.getRelativeUrl())
assignment.open()
self.tic()
......@@ -941,7 +937,6 @@ class TestKMSearch(TestKMMixIn):
See http://www.erp5.org/HowToUseSphinxSE
"""
self.setupSphinx()
portal = self.portal
website = self.portal.web_site_module.km_test_web_site
self.changeSkin('KM')
# in search mode we do NOT access a ZODB object
......@@ -1006,54 +1001,46 @@ class TestKMSearch(TestKMMixIn):
self.setupSphinx()
self.changeSkin('KM')
portal = self.portal
website = self.portal.web_site_module.km_test_web_site
web_page = self.web_page
def sqlresult_to_document_list(result):
return [i.getObject() for i in result]
# create docs to be referenced:
# create docs to be referenced:
# (1) TEST, 002, en
filename = 'TEST-en-002.odt'
file = makeFileUpload(filename)
document1 = self.portal.portal_contributions.newContent(file=file)
file_ = makeFileUpload(filename)
self.portal.portal_contributions.newContent(file=file_)
# (2) TEST, 002, fr
as_name = 'TEST-fr-002.odt'
file = makeFileUpload(filename, as_name)
document2 = self.portal.portal_contributions.newContent(file=file)
file_ = makeFileUpload(filename, as_name)
document2 = self.portal.portal_contributions.newContent(file=file_)
# (3) TEST, 003, en
as_name = 'TEST-en-003.odt'
file = makeFileUpload(filename, as_name)
document3 = self.portal.portal_contributions.newContent(file=file)
file_ = makeFileUpload(filename, as_name)
document3 = self.portal.portal_contributions.newContent(file=file_)
# create docs to contain references in text_content:
# REF, 001, en; "I use reference to look up TEST"
filename = 'REF-en-001.odt'
file = makeFileUpload(filename)
document4 = self.portal.portal_contributions.newContent(file=file)
# REF, 002, en; "I use reference to look up TEST"
filename = 'REF-en-002.odt'
file = makeFileUpload(filename)
document5 = self.portal.portal_contributions.newContent(file=file)
file_ = makeFileUpload(filename)
document5 = self.portal.portal_contributions.newContent(file=file_)
# REFLANG, 001, en: "I use reference and language to look up TEST-fr"
filename = 'REFLANG-en-001.odt'
file = makeFileUpload(filename)
document6 = self.portal.portal_contributions.newContent(file=file)
#filename = 'REFLANG-en-001.odt'
#file = makeFileUpload(filename)
#document6 = self.portal.portal_contributions.newContent(file=file)
# REFVER, 001, en: "I use reference and version to look up TEST-002"
filename = 'REFVER-en-001.odt'
file = makeFileUpload(filename)
document7 = self.portal.portal_contributions.newContent(file=file)
#filename = 'REFVER-en-001.odt'
#file = makeFileUpload(filename)
#document7 = self.portal.portal_contributions.newContent(file=file)
# REFVERLANG, 001, en: "I use reference, version and language to look up TEST-002-en"
filename = 'REFVERLANG-en-001.odt'
file = makeFileUpload(filename)
document8 = self.portal.portal_contributions.newContent(file=file)
#filename = 'REFVERLANG-en-001.odt'
#file = makeFileUpload(filename)
#document8 = self.portal.portal_contributions.newContent(file=file)
self.tic()
# the implicit predecessor will find documents by reference.
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testKM</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testKM</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testKM</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test.erp5.testKM
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_core_proxy_field_legacy
erp5_jquery
erp5_jquery_ui
erp5_ingestion_mysql_innodb_catalog
erp5_ingestion
erp5_pdm
erp5_simulation
erp5_trade
erp5_project
erp5_crm
\ No newline at end of file
......@@ -27,7 +27,7 @@
import warnings
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5OOo.tests.testDms import makeFileUpload
from erp5.component.test.testDms import makeFileUpload
from Products.ERP5Type import Utils
class TestERP5PDFMerge(ERP5TypeTestCase):
......
......@@ -27,7 +27,7 @@
##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5OOo.tests.testDms import makeFileUpload
from erp5.component.test.testDms import makeFileUpload
from time import time
class TestRunMyDoc(ERP5TypeTestCase):
......
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