Commit 6df99cda authored by Rafael Monnerat's avatar Rafael Monnerat Committed by Alain Takoudjou

Include Repository configuration on promise for test

  Permit user update promise file searching by bt5s name, and including its
 repository.

Conflicts:
	product/ERP5Type/tests/ERP5TypeTestCase.py
parent dc05bf86
...@@ -151,7 +151,9 @@ def _getPersistentMemcachedServerDict(): ...@@ -151,7 +151,9 @@ def _getPersistentMemcachedServerDict():
port = os.environ.get('persistent_memcached_server_port', '12121') port = os.environ.get('persistent_memcached_server_port', '12121')
return dict(hostname=hostname, port=port) return dict(hostname=hostname, port=port)
def _createTestPromiseConfigurationFile(promise_path): def _createTestPromiseConfigurationFile(promise_path, bt5_repository_path_list=None):
memcached_url = "memcached://%(hostname)s:%(port)s/" % \
_getVolatileMemcachedServerDict()
kumofs_url = "memcached://%(hostname)s:%(port)s/" % \ kumofs_url = "memcached://%(hostname)s:%(port)s/" % \
_getVolatileMemcachedServerDict() _getVolatileMemcachedServerDict()
memcached_url = "memcached://%(hostname)s:%(port)s/" % \ memcached_url = "memcached://%(hostname)s:%(port)s/" % \
...@@ -165,6 +167,11 @@ def _createTestPromiseConfigurationFile(promise_path): ...@@ -165,6 +167,11 @@ def _createTestPromiseConfigurationFile(promise_path):
promise_config.set('external_service', 'memcached_url',memcached_url) promise_config.set('external_service', 'memcached_url',memcached_url)
promise_config.set('external_service', 'kumofs_url', kumofs_url) promise_config.set('external_service', 'kumofs_url', kumofs_url)
if bt5_repository_path_list is not None:
promise_config.add_section('portal_templates')
promise_config.set('portal_templates', 'repository',
' '.join(bt5_repository_path_list))
if os.environ.get('TEST_CA_PATH') is not None: if os.environ.get('TEST_CA_PATH') is not None:
promise_config.add_section('portal_certificate_authority') promise_config.add_section('portal_certificate_authority')
promise_config.set('portal_certificate_authority', 'certificate_authority_path', promise_config.set('portal_certificate_authority', 'certificate_authority_path',
...@@ -488,7 +495,22 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase): ...@@ -488,7 +495,22 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
% ', '.join(not_found_list)) % ', '.join(not_found_list))
return new_template_list return new_template_list
def setupAutomaticBusinessTemplateRepository(self, def _getBusinessRepositoryPathList(self, searchable_business_template_list=None):
if searchable_business_template_list is None:
searchable_business_template_list = ["erp5_base"]
template_list = []
for bt_id in searchable_business_template_list:
bt_template_list = self._getBTPathAndIdList([bt_id])
if len(bt_template_list):
template_list.append(bt_template_list[0])
if len(template_list) > 0:
return ["/".join(x[0].split("/")[:-1]) for x in template_list]
return []
def setupAutomaticBusinessTemplateRepository(self, accept_public=True,
searchable_business_template_list=("erp5_base",)): searchable_business_template_list=("erp5_base",)):
template_tool = self.portal.portal_templates template_tool = self.portal.portal_templates
bt_set = set(searchable_business_template_list).difference(x['title'] bt_set = set(searchable_business_template_list).difference(x['title']
...@@ -804,12 +826,16 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): ...@@ -804,12 +826,16 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
""" """
return () return ()
def loadPromise(self): def loadPromise(self, searchable_business_template_list=None):
""" Create promise configuration file and load it into configuration """ Create promise configuration file and load it into configuration
""" """
bt5_repository_path_list = self._getBusinessRepositoryPathList(
searchable_business_template_list)
promise_path = os.path.join(instancehome, "promise.cfg") promise_path = os.path.join(instancehome, "promise.cfg")
ZopeTestCase._print('Adding Promise at %s...\n' % promise_path) ZopeTestCase._print('Adding Promise at %s...\n' % promise_path)
_createTestPromiseConfigurationFile(promise_path) _createTestPromiseConfigurationFile(promise_path, bt5_repository_path_list)
config.product_config["/%s" % self.getPortalName()] = \ config.product_config["/%s" % self.getPortalName()] = \
{"promise_path": promise_path} {"promise_path": promise_path}
......
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