Commit ba80b6c0 authored by Rafael Monnerat's avatar Rafael Monnerat

Setup site for Unit Test via configurator (wip)

parent 749379a5
...@@ -47,16 +47,87 @@ def withAbort(func): ...@@ -47,16 +47,87 @@ def withAbort(func):
transaction.abort() transaction.abort()
return wrapped return wrapped
BUSINESS_TEMPLATE_LIST = [
'erp5_promise',
'erp5_upgrader',
'slapos_upgrader',
'erp5_full_text_myisam_catalog',
'erp5_core_proxy_field_legacy',
'erp5_base',
'erp5_administration',
'erp5_workflow',
'erp5_configurator',
'slapos_configurator',
'erp5_simulation',
'erp5_pdm',
'erp5_trade',
'erp5_tiosafe_core',
'erp5_item',
'erp5_forge',
'erp5_ingestion_mysql_innodb_catalog',
'erp5_ingestion',
'erp5_crm',
'erp5_system_event',
'erp5_secure_payment',
'erp5_payzen_secure_payment',
'erp5_ooo_import',
'erp5_odt_style',
'erp5_ods_style',
'erp5_jquery',
'erp5_jquery_ui',
'erp5_dhtml_style',
'erp5_knowledge_pad',
'erp5_web',
'erp5_rss_style',
'erp5_dms',
'erp5_content_translation',
'erp5_software_pdm',
'erp5_computer_immobilisation',
'erp5_open_trade',
'erp5_accounting',
'erp5_commerce',
'erp5_xhtml_jquery_style',
'erp5_credential',
'erp5_km',
'erp5_web_download_theme',
'erp5_web_shacache',
'erp5_data_set',
'erp5_web_shadir',
'erp5_accounting',
'erp5_invoicing',
'erp5_simplified_invoicing',
'erp5_credential_oauth2',
'erp5_accounting_l10n_fr',
'erp5_bearer_token',
'erp5_access_token',
'erp5_project',
'slapos_cache',
'slapos_cloud',
'slapos_slap_tool',
'slapos_category',
'slapos_rest_api_tool_portal_type',
'slapos_rest_api',
'slapos_hypermedia',
'slapos_pdm',
'slapos_crm',
'slapos_accounting',
'slapos_payzen',
'slapos_web',
'slapos_erp5',
]
class testSlapOSMixin(ERP5TypeTestCase): class testSlapOSMixin(ERP5TypeTestCase):
def clearCache(self): def clearCache(self):
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
self.portal.portal_workflow.refreshWorklistCache() self.portal.portal_workflow.refreshWorklistCache()
def getDefaultSitePreferenceId(self): #def getDefaultSitePreferenceId(self):
"""Default id, usefull method to override # """Default id, usefull method to override
""" # """
return "slapos_default_system_preference" # return "slapos_default_system_preference"
def setUpMemcached(self): def setUpMemcached(self):
from Products.ERP5Type.tests.ERP5TypeTestCase import\ from Products.ERP5Type.tests.ERP5TypeTestCase import\
...@@ -130,6 +201,14 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -130,6 +201,14 @@ class testSlapOSMixin(ERP5TypeTestCase):
""" """
return getattr(self.getPortal(), 'acl_users', None) return getattr(self.getPortal(), 'acl_users', None)
def setUpOnce(self):
# Reload promise and include yet another bt5 path.
self.loadPromise(searchable_business_template_list=["erp5_core", "erp5_base", "slapos_configurator"])
self.portal.portal_alarms.promise_template_tool_configuration.solve()
import pdb;pdb.set_trace()
transaction.commit()
self.launchConfigurator()
def afterSetUp(self): def afterSetUp(self):
self.login() self.login()
self.createAlarmStep() self.createAlarmStep()
...@@ -162,16 +241,32 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -162,16 +241,32 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.portal.email_from_address = 'romain@nexedi.com' self.portal.email_from_address = 'romain@nexedi.com'
self.portal.email_to_address = 'romain@nexedi.com' self.portal.email_to_address = 'romain@nexedi.com'
def launchConfigurator(self):
self.login()
# Create new Configuration
business_configuration = self.portal.business_configuration_module.\
newContent(portal_type="Business Configuration",
id="test_slapos_master_configuration_workflow")
business_configuration.setResource(
"workflow_module/slapos_master_configuration_workflow")
transaction.commit()
response_dict = {}
while response_dict.get("command", "next") != "install":
response_dict = self.portal.portal_configurator._next(
business_configuration, {})
transaction.commit()
self.tic()
self.portal.portal_configurator.startInstallation(
business_configuration,REQUEST=self.portal.REQUEST)
def bootstrapSite(self): def bootstrapSite(self):
self.setupPortalAlarms() self.setupPortalAlarms()
self.setupPortalCertificateAuthority() self.setupPortalCertificateAuthority()
self.setUpMemcached() self.setUpMemcached()
self.clearCache() self.clearCache()
# Invoke Post-configurator script, this invokes all
# alarms related to configuration.
self.portal.BusinessConfiguration_invokeSlapOSMasterPromiseAlarmList()
transaction.commit() transaction.commit()
self.tic() self.tic()
...@@ -190,62 +285,6 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -190,62 +285,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
'erp5_workflow', 'erp5_workflow',
'erp5_configurator', 'erp5_configurator',
'slapos_configurator', 'slapos_configurator',
'erp5_simulation',
'erp5_pdm',
'erp5_trade',
'erp5_tiosafe_core',
'erp5_item',
'erp5_forge',
'erp5_ingestion_mysql_innodb_catalog',
'erp5_ingestion',
'erp5_crm',
'erp5_system_event',
'erp5_secure_payment',
'erp5_payzen_secure_payment',
'erp5_ooo_import',
'erp5_odt_style',
'erp5_ods_style',
'erp5_jquery',
'erp5_jquery_ui',
'erp5_dhtml_style',
'erp5_knowledge_pad',
'erp5_web',
'erp5_rss_style',
'erp5_dms',
'erp5_content_translation',
'erp5_software_pdm',
'erp5_computer_immobilisation',
'erp5_open_trade',
'erp5_accounting',
'erp5_commerce',
'erp5_xhtml_jquery_style',
'erp5_credential',
'erp5_km',
'erp5_web_download_theme',
'erp5_web_shacache',
'erp5_data_set',
'erp5_web_shadir',
'erp5_accounting',
'erp5_invoicing',
'erp5_simplified_invoicing',
'erp5_credential_oauth2',
'erp5_accounting_l10n_fr',
'erp5_bearer_token',
'erp5_access_token',
'erp5_project',
'slapos_cache',
'slapos_cloud',
'slapos_slap_tool',
'slapos_category',
'slapos_rest_api_tool_portal_type',
'slapos_rest_api',
'slapos_hypermedia',
'slapos_pdm',
'slapos_crm',
'slapos_accounting',
'slapos_payzen',
'slapos_web',
'slapos_erp5',
] ]
return result return result
......
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