Commit 40964db1 authored by Jérome Perrin's avatar Jérome Perrin

test: move template tool tests from testBusinessTemplate to testTemplateTool

parent 5ee17dd5
......@@ -5593,79 +5593,6 @@ class TestBusinessTemplate(BusinessTemplateMixin):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_getInstalledBusinessTemplate_installed(self):
test_bt = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='erp5_test_bt_%s' % self.id())
test_bt.install()
self.tic()
self.assertEqual(test_bt,
self.portal.portal_templates.getInstalledBusinessTemplate('erp5_test_bt_%s' % self.id()))
def test_getInstalledBusinessTemplate_erp5_core_installed(self):
erp5_core = self.portal.portal_templates.getInstalledBusinessTemplate('erp5_core')
self.assertNotEqual(None, erp5_core)
self.assertEqual('Business Template', erp5_core.getPortalType())
def test_getInstalledBusinessTemplate_not_installed(self):
self.assertEquals(None,
self.portal.portal_templates.getInstalledBusinessTemplate('not_installed'))
def test_getInstalledBusinessTemplate_provision(self):
test_bt = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id(),
provision_list=['erp5_test_bt_%s' % self.id()])
test_bt.install()
self.tic()
self.assertEqual(test_bt,
self.portal.portal_templates.getInstalledBusinessTemplate('erp5_test_bt_%s' % self.id()))
def test_getInstalledBusinessTemplate_replaced(self):
test_bt_v1 = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id(),
version='1')
test_bt_v1.install()
self.tic()
test_bt_v2 = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id(),
version='2')
test_bt_v2.install()
self.assertEqual('replaced', test_bt_v1.getInstallationState())
self.tic()
self.assertEqual(test_bt_v2,
self.portal.portal_templates.getInstalledBusinessTemplate('test_bt_%s' % self.id()))
def test_getInstalledBusinessTemplate_uninstalled(self):
test_bt = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id())
test_bt.install()
test_bt.uninstall()
self.tic()
self.assertEqual(None,
self.portal.portal_templates.getInstalledBusinessTemplate('test_bt_%s' % self.id()))
def test_getInstalledBusinessTemplate_replaced_then_uninstalled(self):
test_bt_v1 = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id(),
version='1')
test_bt_v1.install()
self.tic()
test_bt_v2 = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id(),
version='2')
test_bt_v2.install()
self.assertEqual('replaced', test_bt_v1.getInstallationState())
self.tic()
test_bt_v2.uninstall()
self.assertEqual(None,
self.portal.portal_templates.getInstalledBusinessTemplate('test_bt_%s' % self.id()))
def test_checkDependencies(self):
from Products.ERP5.Document.BusinessTemplate import \
BusinessTemplateMissingDependency
......
......@@ -282,12 +282,79 @@ class TestTemplateTool(ERP5TypeTestCase):
self.assertFalse(compareVersionStrings('1.0rc1', '>= 1.0'))
self.assertTrue(compareVersionStrings('1.0rc1', '>= 1.0rc1'))
def test_getInstalledBusinessTemplate(self):
self.assertNotEquals(None, self.getPortal()\
.portal_templates.getInstalledBusinessTemplate('erp5_core'))
self.assertEqual(None, self.getPortal()\
.portal_templates.getInstalledBusinessTemplate('erp5_toto'))
def test_getInstalledBusinessTemplate_installed(self):
test_bt = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='erp5_test_bt_%s' % self.id())
test_bt.install()
self.tic()
self.assertEqual(test_bt,
self.portal.portal_templates.getInstalledBusinessTemplate('erp5_test_bt_%s' % self.id()))
def test_getInstalledBusinessTemplate_erp5_core_installed(self):
erp5_core = self.portal.portal_templates.getInstalledBusinessTemplate('erp5_core')
self.assertNotEqual(None, erp5_core)
self.assertEqual('Business Template', erp5_core.getPortalType())
def test_getInstalledBusinessTemplate_not_installed(self):
self.assertEquals(None,
self.portal.portal_templates.getInstalledBusinessTemplate('not_installed'))
def test_getInstalledBusinessTemplate_provision(self):
test_bt = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id(),
provision_list=['erp5_test_bt_%s' % self.id()])
test_bt.install()
self.tic()
self.assertEqual(test_bt,
self.portal.portal_templates.getInstalledBusinessTemplate('erp5_test_bt_%s' % self.id()))
def test_getInstalledBusinessTemplate_replaced(self):
test_bt_v1 = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id(),
version='1')
test_bt_v1.install()
self.tic()
test_bt_v2 = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id(),
version='2')
test_bt_v2.install()
self.assertEqual('replaced', test_bt_v1.getInstallationState())
self.tic()
self.assertEqual(test_bt_v2,
self.portal.portal_templates.getInstalledBusinessTemplate('test_bt_%s' % self.id()))
def test_getInstalledBusinessTemplate_uninstalled(self):
test_bt = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id())
test_bt.install()
test_bt.uninstall()
self.tic()
self.assertEqual(None,
self.portal.portal_templates.getInstalledBusinessTemplate('test_bt_%s' % self.id()))
def test_getInstalledBusinessTemplate_replaced_then_uninstalled(self):
test_bt_v1 = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id(),
version='1')
test_bt_v1.install()
self.tic()
test_bt_v2 = self.portal.portal_templates.newContent(
portal_type='Business Template',
title='test_bt_%s' % self.id(),
version='2')
test_bt_v2.install()
self.assertEqual('replaced', test_bt_v1.getInstallationState())
self.tic()
test_bt_v2.uninstall()
self.assertEqual(None,
self.portal.portal_templates.getInstalledBusinessTemplate('test_bt_%s' % self.id()))
def test_revision(self):
template_tool = self.portal.portal_templates
......
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