Commit 4ba5f6fb authored by Rafael Monnerat's avatar Rafael Monnerat

Test Copy, build and install erp5_xhtml_style. This should simulate a bug...

Test Copy, build and install erp5_xhtml_style. This should simulate a bug present into RegisteredSkinSelectionTemplateItem

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32427 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 60fa31f5
...@@ -154,31 +154,41 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -154,31 +154,41 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
user = uf.getUserById('seb').__of__(uf) user = uf.getUserById('seb').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
def getBusinessTemplate(self,title):
"""
Get a business template at portal_templates
"""
template_tool = self.getTemplateTool()
for bt in template_tool.objectValues(filter={'portal_type':'Business Template'}):
if bt.getTitle() == title:
return bt
return None
def stepUseCoreBusinessTemplate(self, sequence=None, def stepUseCoreBusinessTemplate(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Define erp5_core as current bt Define erp5_core as current bt
""" """
template_tool = self.getTemplateTool() core_bt = self.getBusinessTemplate('erp5_core')
core_bt = None
for bt in template_tool.objectValues(filter={'portal_type':'Business Template'}):
if bt.getTitle() == 'erp5_core':
core_bt = bt
break
self.failIf(core_bt is None) self.failIf(core_bt is None)
sequence.edit(current_bt=core_bt) sequence.edit(current_bt=core_bt)
def stepUseXHtmlBusinessTemplate(self, sequence=None,
sequence_list=None, **kw):
"""
Define erp5_xhtml_style as current bt
"""
bt = self.getBusinessTemplate('erp5_xhtml_style')
self.failIf(bt is None)
sequence.edit(current_bt=bt)
def stepCopyCoreBusinessTemplate(self, sequence=None, def stepCopyCoreBusinessTemplate(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Copy erp5_core as new Business Template Copy erp5_core as new Business Template
""" """
template_tool = self.getTemplateTool() template_tool = self.getTemplateTool()
core_bt = None core_bt = self.getBusinessTemplate('erp5_core')
for bt in template_tool.objectValues(filter={'portal_type':'Business Template'}):
if bt.getTitle() == 'erp5_core':
core_bt = bt
break
self.failIf(core_bt is None) self.failIf(core_bt is None)
# make copy # make copy
copy_data = template_tool.manage_copyObjects(ids=[core_bt.getId()]) copy_data = template_tool.manage_copyObjects(ids=[core_bt.getId()])
...@@ -188,6 +198,22 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -188,6 +198,22 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
self.assertEqual(new_bt.getTitle(), 'erp5_core') self.assertEqual(new_bt.getTitle(), 'erp5_core')
sequence.edit(copy_bt=new_bt) sequence.edit(copy_bt=new_bt)
def stepCopyXHtmlBusinessTemplate(self, sequence=None,
sequence_list=None, **kw):
"""
Copy erp5_xhtml_style as new Business Template
"""
template_tool = self.getTemplateTool()
bt = self.getBusinessTemplate('erp5_xhtml_style')
self.failIf(bt is None)
sequence.edit(current_bt=bt)
copy_data = template_tool.manage_copyObjects(ids=[bt.getId()])
ids = template_tool.manage_pasteObjects(copy_data)
new_id = ids[0]['new_id']
new_bt = template_tool._getOb(new_id)
self.assertEqual(new_bt.getTitle(), 'erp5_xhtml_style')
sequence.edit(copy_xhtml_bt=new_bt)
def stepUseCopyCoreBusinessTemplate(self, sequence=None, def stepUseCopyCoreBusinessTemplate(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
...@@ -196,6 +222,14 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -196,6 +222,14 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
bt = sequence.get('copy_bt') bt = sequence.get('copy_bt')
sequence.edit(current_bt=bt, export_bt=bt) sequence.edit(current_bt=bt, export_bt=bt)
def stepUseCopyXHtmlBusinessTemplate(self, sequence=None,
sequence_list=None, **kw):
"""
Define erp5_core as current bt
"""
bt = sequence.get('copy_xhtml_bt')
sequence.edit(current_bt=bt, export_bt=bt)
def stepBuildCopyCoreBusinessTemplate(self, sequence=None, def stepBuildCopyCoreBusinessTemplate(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
...@@ -205,6 +239,15 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -205,6 +239,15 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
self.assertEquals(bt.getTitle(), 'erp5_core') self.assertEquals(bt.getTitle(), 'erp5_core')
bt.build() bt.build()
def stepBuildCopyXHtmlBusinessTemplate(self, sequence=None,
sequence_list=None, **kw):
"""
Build copied xhtml style bt
"""
bt = sequence.get('copy_xhtml_bt')
self.assertEquals(bt.getTitle(), 'erp5_xhtml_style')
bt.build()
def stepInstallCopyCoreBusinessTemplate(self, sequence=None, def stepInstallCopyCoreBusinessTemplate(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
...@@ -5845,6 +5888,23 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -5845,6 +5888,23 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
def test_166_checkXHtmlCopyBuildInstall(self, quiet=quiet, run=run_all_test):
if not run: return
if not quiet:
message = 'Test Check basic copy, build and installation is working'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ', 0, message)
sequence_list = SequenceList()
sequence_string = '\
UseXHtmlBusinessTemplate \
CopyXHtmlBusinessTemplate \
UseCopyXHtmlBusinessTemplate \
BuildCopyXHtmlBusinessTemplate \
InstallCurrentBusinessTemplate \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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