Commit fd76d2be authored by Lucas Carvalho's avatar Lucas Carvalho

Added a new bt5 (erp5_base), to show that some bt5s with ActionTemplateItem works fine.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36563 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f24b2a91
...@@ -79,7 +79,11 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -79,7 +79,11 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
quiet = 1 quiet = 1
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
return ('erp5_csv_style', 'erp5_pdf_style', 'erp5_barcode') return ('erp5_base',
'erp5_csv_style',
'erp5_pdf_style',
'erp5_barcode',
)
def getTitle(self): def getTitle(self):
return "Business Template" return "Business Template"
...@@ -6752,17 +6756,32 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -6752,17 +6756,32 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
self.assertEquals(self.portal.exported_path, self.assertEquals(self.portal.exported_path,
self.portal.portal_catalog.getResultValue(uid=uid)) self.portal.portal_catalog.getResultValue(uid=uid))
# XXX (lucas): Rafael requested to add expectedFailure
@expectedFailure
def test_build_and_export_bt5_into_same_transaction(self): def test_build_and_export_bt5_into_same_transaction(self):
""" """
Copy, build and export a business template into the same transaction. Copy, build and export a business template into the same transaction.
Make sure all objects can be exported, when build() and export() are Make sure all objects can be exported, when build() and export() are
into the same transaction. into the same transaction.
NOTES:
- it works for some business templates. (e.g. erp5_base)
- the object which does not have ._p_jar property is always an
ActionTemplateItem.
""" """
portal = self.getPortalObject() portal = self.getPortalObject()
template_tool = portal.portal_templates template_tool = portal.portal_templates
# Try with erp5_base, which contais ActionTemplateItem and works.
bt5obj = portal.portal_catalog.getResultValue(portal_type='Business Template',
title='erp5_base')
template_copy = template_tool.manage_copyObjects(ids=(bt5obj.getId(),))
new_id_list = template_tool.manage_pasteObjects(template_copy)
new_bt5_id = new_id_list[0]['new_id']
new_bt5_obj = getattr(template_tool, new_bt5_id, None)
new_bt5_obj.edit()
new_bt5_obj.build()
template_tool.export(new_bt5_obj)
# Use erp5_barcode because it contains ActionTemplateItem, which seems to # Use erp5_barcode because it contains ActionTemplateItem, which seems to
# cause problems to be export. Maybe create a test bt5 with all items could # cause problems to be export. Maybe create a test bt5 with all items could
# be more appropriated. # be more appropriated.
......
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