Commit 83440f38 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

testSlapOSMixin: update the way to launch slapos_configurator

This tries to fix the following error in the testnodes:

runTestSuite: ValueError
runTestSuite: The business template erp5_slapos_tutorial was not found on available                          sources.
parent 137f00bc
...@@ -49,11 +49,6 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -49,11 +49,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
self.portal.portal_workflow.refreshWorklistCache() self.portal.portal_workflow.refreshWorklistCache()
#def getDefaultSitePreferenceId(self):
# """Default id, usefull method to override
# """
# return "slapos_default_system_preference"
def createAlarmStep(self): def createAlarmStep(self):
def makeCallAlarm(alarm): def makeCallAlarm(alarm):
def callAlarm(*args, **kwargs): def callAlarm(*args, **kwargs):
...@@ -138,7 +133,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -138,7 +133,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
def isLiveTest(self): def isLiveTest(self):
#return 'ERP5TypeLiveTestCase' in [q.__name__ for q in self.__class__.mro()] #return 'ERP5TypeLiveTestCase' in [q.__name__ for q in self.__class__.mro()]
# XXX - What is the better way to no if we are in live test mode ? # XXX - What is the better way to know if we are in live test mode ?
return not os.environ.has_key('TEST_CA_PATH') return not os.environ.has_key('TEST_CA_PATH')
def _setUpDummyMailHost(self): def _setUpDummyMailHost(self):
...@@ -163,7 +158,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -163,7 +158,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
""" """
return getattr(self.getPortal(), 'acl_users', None) return getattr(self.getPortal(), 'acl_users', None)
def setUpOnce(self): def setUpConfiguratorOnce(self):
self.commit() self.commit()
self.portal.portal_templates.updateRepositoryBusinessTemplateList( self.portal.portal_templates.updateRepositoryBusinessTemplateList(
repository_list=self.portal.portal_templates.getRepositoryList()) repository_list=self.portal.portal_templates.getRepositoryList())
...@@ -177,6 +172,10 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -177,6 +172,10 @@ class testSlapOSMixin(ERP5TypeTestCase):
if self.isLiveTest(): if self.isLiveTest():
self.setUpPersistentDummyMailHost() self.setUpPersistentDummyMailHost()
return return
# Execute the business configuration if not installed
business_configuration = self.getBusinessConfiguration()
if (business_configuration.getSimulationState() != 'installed'):
self.portal.portal_caches.erp5_site_global_id = '%s' % random.random() self.portal.portal_caches.erp5_site_global_id = '%s' % random.random()
self.portal.portal_caches._p_changed = 1 self.portal.portal_caches._p_changed = 1
self.createCertificateAuthorityFile() self.createCertificateAuthorityFile()
...@@ -193,9 +192,6 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -193,9 +192,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
config.product_config["initsite"] = initsite config.product_config["initsite"] = initsite
self.createCertificateAuthorityFile()
if not getattr(self.portal, 'is_site_bootstrapped', 0):
self.portal.is_site_bootstrapped = 1
self.bootstrapSite() self.bootstrapSite()
self.portal._p_changed = 1 self.portal._p_changed = 1
self.commit() self.commit()
...@@ -219,6 +215,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -219,6 +215,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
"slapos_master_configuration_workflow"] "slapos_master_configuration_workflow"]
def launchConfigurator(self): def launchConfigurator(self):
self.logMessage('SlapOS launchConfigurator')
self.login() self.login()
# Create new Configuration # Create new Configuration
business_configuration = self.getBusinessConfiguration() business_configuration = self.getBusinessConfiguration()
...@@ -233,11 +230,14 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -233,11 +230,14 @@ class testSlapOSMixin(ERP5TypeTestCase):
business_configuration,REQUEST=self.portal.REQUEST) business_configuration,REQUEST=self.portal.REQUEST)
def bootstrapSite(self): def bootstrapSite(self):
self.logMessage('SlapOS bootstrapSite')
self.setupPortalAlarms() self.setupPortalAlarms()
self.getDefaultSystemPreference().setPreferredHateoasUrl("http://dummy/") self.getDefaultSystemPreference().setPreferredHateoasUrl("http://dummy/")
self.clearCache() self.clearCache()
self.tic() self.tic()
self.setUpConfiguratorOnce()
self.tic()
def getExpectedBusinessTemplateInstalledAfterConfiguration(self): def getExpectedBusinessTemplateInstalledAfterConfiguration(self):
return [ 'erp5_core', return [ 'erp5_core',
...@@ -340,6 +340,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -340,6 +340,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
'erp5_full_text_myisam_catalog', 'erp5_full_text_myisam_catalog',
'erp5_core_proxy_field_legacy', 'erp5_core_proxy_field_legacy',
'erp5_base', 'erp5_base',
'erp5_accounting',
'erp5_workflow', 'erp5_workflow',
'erp5_configurator', 'erp5_configurator',
'slapos_configurator', 'slapos_configurator',
...@@ -361,7 +362,8 @@ class TestSlapOSDummy(testSlapOSMixin): ...@@ -361,7 +362,8 @@ class TestSlapOSDummy(testSlapOSMixin):
run_all_test = 1 run_all_test = 1
def test(self): def test(self):
"""Dummy test in order to fire up Business Template testing""" """Dummy test in order to fire up Business Template testing"""
self.assertTrue(True) bt5_list = self.portal.portal_templates.getInstalledBusinessTemplateTitleList()
self.assertTrue('slapos_erp5' in bt5_list, bt5_list)
def getTitle(self): def getTitle(self):
return "Dummy tests in order to have tests from BT5 run" return "Dummy tests in order to have tests from BT5 run"
......
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