Commit 8c667944 authored by Bryton Lacquement's avatar Bryton Lacquement

testTemplateTool: test the migration of actions in erp5_csv_style when updating the bt

cf commit 550e81b0
parent 550e81b0
......@@ -34,6 +34,7 @@ import random
import tempfile
from xml.dom.minidom import getDOMImplementation
from App.config import getConfiguration
from Products.CMFCore.ActionsTool import ActionsTool
from Products.ERP5VCS.WorkingCopy import getVcsTool
from Products.ERP5.Document.BusinessTemplate import \
......@@ -53,7 +54,7 @@ class TestTemplateTool(ERP5TypeTestCase):
def getTitle(self):
return "Template Tool"
......@@ -147,13 +148,43 @@ class TestTemplateTool(ERP5TypeTestCase):
the new bt5 is not installed, only imported.
global PropertiesTool
class PropertiesTool(ActionsTool):
id = 'portal_properties'
cls = PropertiesTool
# Assign a fake properties tool to the portal
tool = PropertiesTool()
self.portal._setObject(, tool, set_owner=False, suppress_events=True)
del tool
template_tool = self.portal.portal_templates
url = ''
old_bt = template_tool.getInstalledBusinessTemplate('erp5_csv_style')
# fake different revision
url = ''
new_bt = template_tool.getInstalledBusinessTemplate('erp5_csv_style')
# Break the properties tool
self.assertIs(self.portal.portal_properties.__class__, cls)
del PropertiesTool
self.assertIsNot(self.portal.portal_properties.__class__, cls)
# Remove portal.portal_properties
from Products.ERP5Type.dynamic.portal_type_class import \
_bootstrapped, synchronizeDynamicModules
synchronizeDynamicModules(self.portal, force=True)
# The bt from this repo
url = self._getBTPathAndIdList(('erp5_csv_style',))[0][0]
new_bt = template_tool.updateBusinessTemplateFromUrl(url)
self.assertNotEquals(old_bt, new_bt)
self.assertEqual('erp5_csv_style', new_bt.getTitle())
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