Commit cfa78d1d authored by Tatuya Kamada's avatar Tatuya Kamada

Reproduce a issue that BusinessTemplate wrongly removes the skins of another...

Reproduce a issue that BusinessTemplate wrongly removes the skins of another business template when upgrade a business template. In the test, erp5_geek and erp5_nerd has a same name view, and the view is removed from erp5_nerd, then the same name fields in another skin was wrongly removed, too.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36791 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 77b6da1f
...@@ -701,6 +701,22 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -701,6 +701,22 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
selection.append('erp5_geek') selection.append('erp5_geek')
ps.manage_skinLayers(skinpath = tuple(selection), skinname = skin_name, add_skin = 1) ps.manage_skinLayers(skinpath = tuple(selection), skinname = skin_name, add_skin = 1)
def stepCreateAnotherSkinFolder(self, sequence=None, sequence_list=None, **kw):
"""
Create another skin folder
"""
ps = self.getSkinsTool()
ps.manage_addProduct['OFSP'].manage_addFolder('erp5_nerd')
skin_folder = ps._getOb('erp5_nerd', None)
self.failUnless(skin_folder is not None)
sequence.edit(another_skin_folder_id=skin_folder.getId())
# add skin in layers
for skin_name, selection in ps.getSkinPaths():
selection = selection.split(',')
if 'erp5_nerd' not in selection:
selection.append('erp5_nerd')
ps.manage_skinLayers(skinpath = tuple(selection), skinname = skin_name, add_skin = 1)
def stepCreateStaticSkinFolder(self, sequence=None, sequence_list=None, **kw): def stepCreateStaticSkinFolder(self, sequence=None, sequence_list=None, **kw):
""" """
Create a skin folder not managed by the bt5 Create a skin folder not managed by the bt5
...@@ -763,10 +779,10 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -763,10 +779,10 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
group_dict[group] = id_list group_dict[group] = id_list
sequence.edit(form_id=form_id, group_dict=group_dict) sequence.edit(form_id=form_id, group_dict=group_dict)
def stepCreateNewFormIntoErp5Base(self, sequence=None, sequence_list=None): def stepCreateNewFormIntoErp5Nerd(self, sequence=None, sequence_list=None):
"""Create a new ERP5 Form in a skin folder.""" """Create a new ERP5 Form in a skin folder."""
ps = self.getSkinsTool() ps = self.getSkinsTool()
skin_folder = ps._getOb('erp5_base', None) skin_folder = ps._getOb('erp5_nerd', None)
self.assertNotEquals(skin_folder, None) self.assertNotEquals(skin_folder, None)
form_id = 'Geek_view' form_id = 'Geek_view'
addERP5Form = skin_folder.manage_addProduct['ERP5Form'].addERP5Form addERP5Form = skin_folder.manage_addProduct['ERP5Form'].addERP5Form
...@@ -785,6 +801,7 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -785,6 +801,7 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
for field in form.get_fields_in_group(group): for field in form.get_fields_in_group(group):
id_list.append(field.getId()) id_list.append(field.getId())
group_dict[group] = id_list group_dict[group] = id_list
sequence.edit(another_form_id=form_id)
def stepRemoveForm(self, sequence=None, sequence_list=None): def stepRemoveForm(self, sequence=None, sequence_list=None):
...@@ -799,19 +816,6 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -799,19 +816,6 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
form = skin_folder._getOb(form_id, None) form = skin_folder._getOb(form_id, None)
self.assertEquals(form, None) self.assertEquals(form, None)
def stepRemoveFormFromErp5Base(self, sequence=None, sequence_list=None):
"""Remove an ERP5 Form."""
ps = self.getSkinsTool()
skin_folder = ps._getOb('erp5_base', None)
self.assertNotEquals(skin_folder, None)
form_id = sequence.get('form_id')
form = skin_folder._getOb(form_id, None)
self.assertNotEquals(form, None)
skin_folder.manage_delObjects([form_id])
form = skin_folder._getOb(form_id, None)
self.assertEquals(form, None)
def stepAddFormField(self, sequence=None, sequence_list=None): def stepAddFormField(self, sequence=None, sequence_list=None):
"""Add a field to an ERP5 Form.""" """Add a field to an ERP5 Form."""
ps = self.getSkinsTool() ps = self.getSkinsTool()
...@@ -884,10 +888,10 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -884,10 +888,10 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
form = skin_folder._getOb(form_id, None) form = skin_folder._getOb(form_id, None)
self.assertEquals(form, None) self.assertEquals(form, None)
def stepCheckFormIsNotRemovedFromErp5Base(self, sequence=None, sequence_list=None): def stepCheckFormIsNotRemovedFromErp5Nerd(self, sequence=None, sequence_list=None):
"""Check the form is not exist in custom.""" """Check the form is not exist in erp5_nerd."""
ps = self.getSkinsTool() ps = self.getSkinsTool()
skin_folder = ps._getOb('erp5_base', None) skin_folder = ps._getOb('erp5_nerd', None)
self.assertNotEquals(skin_folder, None) self.assertNotEquals(skin_folder, None)
form_id = sequence.get('form_id') form_id = sequence.get('form_id')
form = skin_folder._getOb(form_id, None) form = skin_folder._getOb(form_id, None)
...@@ -925,6 +929,17 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -925,6 +929,17 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
id_list.append(field.getId()) id_list.append(field.getId())
self.assertEquals(group_dict[group], id_list) self.assertEquals(group_dict[group], id_list)
def stepCheckFieldTitleIsNotRemovedFromErp5Nerd(self, sequence=None, sequence_list=None):
"""Check that field title is not removed form erp5_nerd."""
ps = self.getSkinsTool()
skin_folder = ps._getOb('erp5_nerd', None)
self.assertNotEquals(skin_folder, None)
form_id = sequence.get('form_id')
form = skin_folder._getOb(form_id, None)
self.assertNotEquals(form, None)
title_filed =form._getOb('my_title', None)
self.assertNotEquals(title_filed, None)
def stepCreateNewObjectInSkinSubFolder(self, sequence=None, sequence_list=None, **kw): def stepCreateNewObjectInSkinSubFolder(self, sequence=None, sequence_list=None, **kw):
""" """
Create a new object in skin subfolder Create a new object in skin subfolder
...@@ -995,6 +1010,21 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -995,6 +1010,21 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
self.failIfEqual(skin_id, '') self.failIfEqual(skin_id, '')
bt.edit(template_skin_id_list=[skin_id]) bt.edit(template_skin_id_list=[skin_id])
def stepAddAnotherSkinFolderToBusinessTemplate(self, sequence=None, sequence_list=None, **kw):
"""
Add skin folder to business template
"""
bt = sequence.get('current_bt', None)
self.failUnless(bt is not None)
skin_id = sequence.get('another_skin_folder_id', '')
self.failIfEqual(skin_id, '')
current_skin_id_list = bt.getTemplateSkinIdList()
template_skin_id_list = []
template_skin_id_list.extend(current_skin_id_list)
template_skin_id_list.append(skin_id)
bt.edit(template_skin_id_list=template_skin_id_list)
def stepAddRegistredSelectionToBusinessTemplate(self, sequence=None, def stepAddRegistredSelectionToBusinessTemplate(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
...@@ -5357,9 +5387,11 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -5357,9 +5387,11 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
def test_34_RemoveForm(self, quiet=quiet, run=run_all_test): def test_34_RemoveForm(self, quiet=quiet, run=run_all_test):
""" """
- Add a form into erp5_geek and custom skin folder - Add a form into the skin folders of erp5_geek and erp5_nerd
- Remove the form from erp5_geek - Remove the form from erp5_geek
- Check the form is removed from erp5_geek - Check that the form is removed from erp5_geek
- Check that the form is not removed from erp5_nerd
- Check that the title field is not removed from erp5_nerd
""" """
if not run: return if not run: return
if not quiet: if not quiet:
...@@ -5368,15 +5400,16 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -5368,15 +5400,16 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
LOG('Testing... ', 0, message) LOG('Testing... ', 0, message)
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
CreateNewFormIntoErp5Base \
CreateSkinFolder \ CreateSkinFolder \
CreateAnotherSkinFolder \
CreateNewFormIntoErp5Nerd \
CreateNewForm \ CreateNewForm \
CreateNewBusinessTemplate \ CreateNewBusinessTemplate \
UseExportBusinessTemplate \ UseExportBusinessTemplate \
AddSkinFolderToBusinessTemplate \ AddSkinFolderToBusinessTemplate \
AddAnotherSkinFolderToBusinessTemplate \
BuildBusinessTemplate \ BuildBusinessTemplate \
SaveBusinessTemplate \ SaveBusinessTemplate \
RemoveForm \
\ \
ImportBusinessTemplate \ ImportBusinessTemplate \
UseImportBusinessTemplate \ UseImportBusinessTemplate \
...@@ -5384,13 +5417,16 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -5384,13 +5417,16 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
Tic \ Tic \
\ \
CheckFormGroups \ CheckFormGroups \
\
RemoveForm \ RemoveForm \
CreateNewBusinessTemplate \ CreateNewBusinessTemplate \
UseExportBusinessTemplate \ UseExportBusinessTemplate \
AddSkinFolderToBusinessTemplate \ AddSkinFolderToBusinessTemplate \
AddAnotherSkinFolderToBusinessTemplate \
BuildBusinessTemplate \ BuildBusinessTemplate \
SaveBusinessTemplate \ SaveBusinessTemplate \
CreateNewForm \ \
CheckFieldTitleIsNotRemovedFromErp5Nerd \
\ \
ImportBusinessTemplate \ ImportBusinessTemplate \
UseImportBusinessTemplate \ UseImportBusinessTemplate \
...@@ -5398,12 +5434,12 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -5398,12 +5434,12 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
Tic \ Tic \
\ \
CheckFormIsRemoved \ CheckFormIsRemoved \
CheckFormIsNotRemovedFromErp5Base \ CheckFormIsNotRemovedFromErp5Nerd \
CheckFieldTitleIsNotRemovedFromErp5Nerd \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
def test_getInstalledBusinessTemplate(self): def test_getInstalledBusinessTemplate(self):
self.assertNotEquals(None, self.getPortal()\ self.assertNotEquals(None, self.getPortal()\
.portal_templates.getInstalledBusinessTemplate('erp5_core')) .portal_templates.getInstalledBusinessTemplate('erp5_core'))
......
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