Commit 208f34eb authored by Jérome Perrin's avatar Jérome Perrin

testBusinessTemplate: integration test of legacy document classes

Test importing a business templates with classes from Products.ERP5Type.Document
parent b18e6a76
...@@ -6380,6 +6380,45 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -6380,6 +6380,45 @@ class TestBusinessTemplate(BusinessTemplateMixin):
self.assertEqual("FooBar", getattr(foo_in_portal, "title")) self.assertEqual("FooBar", getattr(foo_in_portal, "title"))
self.uninstallBusinessTemplate('test_168_CheckPortalTypeAndPathInSameBusinessTemplate') self.uninstallBusinessTemplate('test_168_CheckPortalTypeAndPathInSameBusinessTemplate')
def test_legacy_products_erp5_document_compatibility(self):
"""Check we can import a business template referencing classes from
Products.ERP5Type.Document namespace and that the classes are migrated
"""
import Products.ERP5.tests
bt_path = os.path.join(
os.path.dirname(Products.ERP5.tests.__file__),
'test_data',
'BusinessTemplate_test_legacy_products_erp5_document_compatibility')
bt = self.portal.portal_templates.download(bt_path)
bt.install()
self.tic()
# when loaded, the legacy classes have been updated to use
# erp5.portal_type namespace
self.assertEqual(
str(self.portal.person_module.test_person.__class__),
"<class 'erp5.portal_type.Person'>")
self.assertEqual(
str(self.portal.person_module.test_person.default_address.__class__),
"<class 'erp5.portal_type.Address'>")
self.assertEqual(
str(self.portal.person_module.test_person.default_career.__class__),
"<class 'erp5.portal_type.Career'>")
self.assertEqual(
str(self.portal.person_module.test_person.default_email.__class__),
"<class 'erp5.portal_type.Email'>")
self.assertEqual(
str(self.portal.person_module.test_person.default_fax.__class__),
"<class 'erp5.portal_type.Fax'>")
self.assertEqual(
str(self.portal.person_module.test_person.default_telephone.__class__),
"<class 'erp5.portal_type.Telephone'>")
self.assertEqual(
str(self.portal.person_module.test_person.default_link.__class__),
"<class 'erp5.portal_type.Link'>")
self.uninstallBusinessTemplate('BusinessTemplate_test_legacy_products_erp5_document_compatibility')
def test_169_CheckPortalTypeAndPathInSameBusinessTemplateAndBrokenObjectModification(self): def test_169_CheckPortalTypeAndPathInSameBusinessTemplateAndBrokenObjectModification(self):
""" """
Make sure we have possibility to change broken Make sure we have possibility to change broken
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Person" module="Products.ERP5Type.Document.Person"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Author</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>Associate</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Author</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>Associate</string>
<string>Auditor</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>first_name</string> </key>
<value> <string>Test</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_person</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>last_name</string> </key>
<value> <string>Person</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Person</string> </value>
</item>
<item>
<key> <string>user_id</string> </key>
<value> <string>P6</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="GeographicAddress" module="Products.ERP5Type.Document.GeographicAddress"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>city</string> </key>
<value> <string>city</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>default_address</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Address</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>street_address</string> </key>
<value> <string>the address</string> </value>
</item>
<item>
<key> <string>zip_code</string> </key>
<value> <string>zip code</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Career" module="Products.ERP5Type.Document.Career"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</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>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>default_career</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Career</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Url" module="Products.ERP5Type.Document.Url"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>coordinate_text</string> </key>
<value> <string>mail@example.com</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>default_email</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Email</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Telephone" module="Products.ERP5Type.Document.Telephone"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>coordinate_text</string> </key>
<value> <string>123456</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>default_fax</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Fax</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Url" module="Products.ERP5Type.Document.Url"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>default_link</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Link</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>url_string</string> </key>
<value> <string>https://example.com</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Telephone" module="Products.ERP5Type.Document.Telephone"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>coordinate_text</string> </key>
<value> <string>123456</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>default_telephone</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Telephone</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
A business templates with documents exported with their __class__ from Products.ERP5Type.Document
person_module/test_person
person_module/test_person/**
\ No newline at end of file
BusinessTemplate_test_legacy_products_erp5_document_compatibility
\ 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