Commit 1ba9bd01 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: Updated tests

parent 4df1d2db
...@@ -141,10 +141,12 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -141,10 +141,12 @@ class TestBusinessPackage(ERP5TypeTestCase):
return tuple(manager_list) return tuple(manager_list)
def _addFolderInERP5(self): def _addFolderInERP5(self, id=None):
""" """
""" """
test_folder = self.portal.newContent(id='test_folder', if not id:
id = 'test_folder'
test_folder = self.portal.newContent(id=id,
portal_type='Folder', portal_type='Folder',
title='couscous', title='couscous',
) )
...@@ -155,7 +157,7 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -155,7 +157,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
# ********** TESTS FOR COMBINING MULTIPLE BUSINESS MANAGERS ************ # ********** TESTS FOR COMBINING MULTIPLE BUSINESS MANAGERS ************
######################################################################### #########################################################################
def test_combineBusinessItemWithDifferentSign(self): def _combineBusinessItemWithDifferentSign(self):
""" """
Same path, same value, differernt sign Same path, same value, differernt sign
""" """
...@@ -180,7 +182,7 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -180,7 +182,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
managerB.build() managerB.build()
bm_list = [managerA, managerB] bm_list = [managerA, managerB]
combinedBM = portal_templates.combinedBusinessManager(bm_list) combinedBM = portal_templates.combineMultipleBusinessManager(bm_list)
# ********** TESTS FOR DIFFERENT INSTALLATION USE CASES ************ # ********** TESTS FOR DIFFERENT INSTALLATION USE CASES ************
##################################################################### #####################################################################
...@@ -329,6 +331,7 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -329,6 +331,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
def test_useCase_V(self): def test_useCase_V(self):
""" """
Case V: Case V:
_ A B: ??
""" """
portal_templates = self.portal.portal_templates portal_templates = self.portal.portal_templates
managerA = self._createBusinessManager() managerA = self._createBusinessManager()
...@@ -362,6 +365,7 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -362,6 +365,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
portal_templates.installMultipleBusinessManager([managerA_new,]) portal_templates.installMultipleBusinessManager([managerA_new,])
installed_test_folder = self.portal.restrictedTraverse(folder_path)
# XXX: What to expect: couscous or new_couscous? or conflict display # XXX: What to expect: couscous or new_couscous? or conflict display
def test_useCase_VI(self): def test_useCase_VI(self):
...@@ -425,17 +429,23 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -425,17 +429,23 @@ class TestBusinessPackage(ERP5TypeTestCase):
managerA_new.build() managerA_new.build()
managerA_new.setStatus('uninstalled') managerA_new.setStatus('uninstalled')
self.portal.manage_delObjects([test_folder.getId(),])
portal_templates.installMultipleBusinessManager([managerA_new,]) portal_templates.installMultipleBusinessManager([managerA_new,])
# Delete the object from ZODB so as we can install the object there installed_test_folder = self.portal.restrictedTraverse(folder_path)
self.portal.manage_delObjects([test_folder.getId(),]) self.assertEquals(installed_test_folder.getTitle(), 'couscous')
managerA_new, = self._copyBusinessManager([managerA.id,])
managerA_new.build()
managerA_new.setStatus('uninstalled') managerA_new.setStatus('uninstalled')
# Delete the object from ZODB so as we can install the object there
self.portal.manage_delObjects([installed_test_folder.getId(),])
portal_templates.installMultipleBusinessManager([managerA_new,]) portal_templates.installMultipleBusinessManager([managerA_new,])
# Expected undecided, if forced installation, then install test_folder, # This should install nothing as we prefer user changes
# otherwise let the state of ZODB unchanged self.assertRaises(KeyError, lambda: self.portal.restrictedTraverse(folder_path))
def test_useCase_VIII(self): def test_useCase_VIII(self):
""" """
...@@ -461,7 +471,6 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -461,7 +471,6 @@ class TestBusinessPackage(ERP5TypeTestCase):
# Delete the object from ZODB so as we can install the object there # Delete the object from ZODB so as we can install the object there
self.portal.manage_delObjects([test_folder.getId(),]) self.portal.manage_delObjects([test_folder.getId(),])
portal_templates.installMultipleBusinessManager([managerA_new,]) portal_templates.installMultipleBusinessManager([managerA_new,])
installed_test_folder = self.portal.restrictedTraverse(folder_path) installed_test_folder = self.portal.restrictedTraverse(folder_path)
...@@ -475,11 +484,11 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -475,11 +484,11 @@ class TestBusinessPackage(ERP5TypeTestCase):
managerA_new.setStatus('uninstalled') managerA_new.setStatus('uninstalled')
# Delete the object from ZODB so as we can install the object there # Delete the object from ZODB so as we can install the object there
self.portal.manage_delObjects([test_folder.getId(),]) self.portal.manage_delObjects([installed_test_folder.getId(),])
portal_templates.installMultipleBusinessManager([managerA_new,]) portal_templates.installMultipleBusinessManager([managerA_new,])
# Expected result undecide, if forced installation, then install the folder # Expected result undecided, if forced installation, then install the folder
# from updated Business Manager, otherwise let the user change in ZODB # from updated Business Manager, otherwise let the user change in ZODB
# persist, i.e, no test_folder # persist, i.e, no test_folder
...@@ -686,6 +695,8 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -686,6 +695,8 @@ class TestBusinessPackage(ERP5TypeTestCase):
managerA_new.build() managerA_new.build()
managerA_new.setStatus('uninstalled') managerA_new.setStatus('uninstalled')
# Delete the object from ZODB so as we can install the object there
self.portal.manage_delObjects([test_folder.getId(),])
# Install the Business Manager # Install the Business Manager
portal_templates.installMultipleBusinessManager([managerA_new,]) portal_templates.installMultipleBusinessManager([managerA_new,])
...@@ -697,7 +708,7 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -697,7 +708,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
managerA_new.build() managerA_new.build()
managerA_new.setStatus('uninstalled') managerA_new.setStatus('uninstalled')
test_folder.edit(title='new_couscous') installed_test_folder.edit(title='new_couscous')
# Install the Business Manager # Install the Business Manager
portal_templates.installMultipleBusinessManager([managerA_new,]) portal_templates.installMultipleBusinessManager([managerA_new,])
...@@ -728,6 +739,8 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -728,6 +739,8 @@ class TestBusinessPackage(ERP5TypeTestCase):
managerA_new.build() managerA_new.build()
managerA_new.setStatus('uninstalled') managerA_new.setStatus('uninstalled')
# Delete the object from ZODB so as we can install the object there
self.portal.manage_delObjects([test_folder.getId(),])
# Install the Business Manager # Install the Business Manager
portal_templates.installMultipleBusinessManager([managerA_new,]) portal_templates.installMultipleBusinessManager([managerA_new,])
......
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