diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py index 9f3a5a380e10232b132530c36ff5c8b231cf5082..352206493eebc423854e47ee6ab0691e4cd5ad91 100644 --- a/product/ERP5Type/tests/ERP5TypeTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeTestCase.py @@ -541,28 +541,36 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase): DeprecationWarning) return self.createUserAssignment(user, assignment_kw) - def setupAutomaticBusinessTemplateRepository(self, accept_public=True): + def setupAutomaticBusinessTemplateRepository(self, accept_public=True, + searchable_business_template_list=None): # Try to setup some valid Repository List by reusing ERP5TypeTestCase API. # if accept_public we can accept public repository can be set, otherwise # we let failure happens. + if searchable_business_template_list is None: + searchable_business_template_list = ["erp5_base"] # Assume that the public official repository is a valid repository public_bt5_repository_list = ['http://www.erp5.org/dists/snapshot/bt5/'] - - template_list = self._getBTPathAndIdList(["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: - bt5_repository_path = "/".join(template_list[0][0].split("/")[:-1]) + bt5_repository_path_list = ["/".join(x[0].split("/")[:-1]) + for x in template_list] if accept_public: try: self.portal.portal_templates.updateRepositoryBusinessTemplateList( - [bt5_repository_path], None) + bt5_repository_path_list, None) except (RuntimeError, IOError), e: # If bt5 repository is not a repository use public one. self.portal.portal_templates.updateRepositoryBusinessTemplateList( public_bt5_repository_list) else: self.portal.portal_templates.updateRepositoryBusinessTemplateList( - [bt5_repository_path], None) + bt5_repository_path_list, None) elif accept_public: self.portal.portal_templates.updateRepositoryBusinessTemplateList( public_bt5_repository_list)