Commit b8e0957c authored by Arnaud Fontaine's avatar Arnaud Fontaine Committed by Julien Muchembled

TemplateTool: Do not change the resolved depends list when installing bt5s with depends.

Considering erp5_configurator_ung depending on erp5_configurator which in turn
depends on erp5_workflow, if erp5_workflow and erp5_configurator_ung are
specifically added to the list of bt5 installed with depends, then erp5_workflow
ended up being installed *after* erp5_configurator.

(cherry picked from commit 0101c3a0)
parent 12a26ac7
......@@ -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:
......
......@@ -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,16 +599,33 @@ 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")
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
......
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