diff --git a/product/ERP5/Tool/TemplateTool.py b/product/ERP5/Tool/TemplateTool.py index d69ac39ef7169589d446fe32c462c9f81e2f5544..d9a6b235775e938083813bee2a8d2f71eec59e2f 100644 --- a/product/ERP5/Tool/TemplateTool.py +++ b/product/ERP5/Tool/TemplateTool.py @@ -1213,9 +1213,7 @@ class TemplateTool (BaseTool): activate_kw = dict(activity="SQLQueue", tag="start_%s" % (time.time())) - missing_dependency_list.extend([x for x in resolved_template_list if - x[1] in template_list]) - for repository, bt_id in missing_dependency_list: + for repository, bt_id in resolved_template_list: bt_url = '%s/%s' % (repository, bt_id) param_dict = dict(download_url=bt_url, only_newer=only_newer) if update_catalog is not _MARKER: diff --git a/product/ERP5/tests/testTemplateTool.py b/product/ERP5/tests/testTemplateTool.py index f116074f1b7fb5c2376d19c58cbf616332b27ece..542f8b144ab369f2d73cece0dc742b32db77b4fc 100644 --- a/product/ERP5/tests/testTemplateTool.py +++ b/product/ERP5/tests/testTemplateTool.py @@ -31,6 +31,7 @@ import os import shutil import unittest import random +import transaction from App.config import getConfiguration from Products.ERP5VCS.WorkingCopy import getVcsTool @@ -563,8 +564,10 @@ class TestTemplateTool(ERP5TypeTestCase): self.assertEquals(bt.getTitle(), bt5_name) def test_installBusinessTemplatesFromRepository_install_dependency(self): - """ Test if update catalog is trigger when needed. + """Test if dependencies are automatically installed properly """ + # erp5_configurator_{ung,standard} depends on erp5_configurator which in + # turn depends on erp5_workflow bt5_name_list = ['erp5_configurator_ung', 'erp5_configurator_standard'] template_tool = self.portal.portal_templates for repos in template_tool.getRepositoryList(): @@ -596,17 +599,34 @@ class TestTemplateTool(ERP5TypeTestCase): (repository, bt5_name)) self.assertNotEquals(dependency_list, []) - self.tic() template_tool.installBusinessTemplateListFromRepository( bt5_name_list, install_dependency=True) for bt5_name in bt5_name_list: bt = template_tool.getInstalledBusinessTemplate(bt5_name) self.assertNotEquals(bt, None) - bt = template_tool.getInstalledBusinessTemplate("erp5_configurator") - self.assertNotEquals(bt, None) - bt = template_tool.getInstalledBusinessTemplate("erp5_workflow") + + bt = template_tool.getInstalledBusinessTemplate("erp5_configurator") + self.assertNotEquals(bt, None) + bt = template_tool.getInstalledBusinessTemplate("erp5_workflow") + self.assertNotEquals(bt, None) + transaction.abort() + + # Same as above but also check that dependencies are properly resolved if + # one of the dependency is explicitly added to the list of bt5 to be + # installed + template_tool.installBusinessTemplateListFromRepository( + bt5_name_list + ['erp5_workflow'], + install_dependency=True) + for bt5_name in bt5_name_list: + bt = template_tool.getInstalledBusinessTemplate(bt5_name) self.assertNotEquals(bt, None) + bt = template_tool.getInstalledBusinessTemplate("erp5_configurator") + self.assertNotEquals(bt, None) + bt = template_tool.getInstalledBusinessTemplate("erp5_workflow") + self.assertNotEquals(bt, None) + transaction.abort() + def test_sortBusinessTemplateList(self): """Check sorting of a list of business template by their dependencies """