From 7ffe13065d10a9eaa80da5950bd511e80d909a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 19 Nov 2007 10:07:52 +0000 Subject: [PATCH] tests that ERP5Site_createModule create correct forms and set actions correctly git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17672 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testERP5Core.py | 45 ++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/product/ERP5/tests/testERP5Core.py b/product/ERP5/tests/testERP5Core.py index 162c5acb38..f0102ce60c 100644 --- a/product/ERP5/tests/testERP5Core.py +++ b/product/ERP5/tests/testERP5Core.py @@ -93,13 +93,14 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): module_id='unittest_module' module_title='UnitTests' + + skins_tool = self.portal.portal_skins + types_tool = self.portal.portal_types self.failIf(self.portal._getOb(module_id, None) is not None) - self.assertEqual(self.portal.portal_skins._getOb(portal_skins_folder, None), - None) - self.assertEqual(self.portal.portal_types.getTypeInfo(module_portal_type), - None) - self.assertEqual(self.portal.portal_types.getTypeInfo(object_portal_type), - None) + self.assertEqual(skins_tool._getOb(portal_skins_folder, None), None) + self.assertEqual(types_tool._getOb(module_portal_type, None), None) + self.assertEqual(types_tool._getOb(object_portal_type, None), None) + self.portal.ERP5Site_createModule(module_portal_type=module_portal_type, portal_skins_folder=portal_skins_folder, object_portal_type=object_portal_type, @@ -107,16 +108,32 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): module_id=module_id, module_title=module_title) self.failUnless(self.portal._getOb(module_id, None) is not None) - self.assertNotEqual( - self.portal.portal_skins._getOb(portal_skins_folder, None), None) self.assertEquals(module_title, self.portal._getOb(module_id).getTitle()) - self.assertNotEqual(self.portal.portal_types.getTypeInfo(module_portal_type), - None) - self.assertNotEqual(self.portal.portal_types.getTypeInfo(object_portal_type), - None) - #self.assertEqual(self.portal.portal_types[object_portal_type].title, - # object_title) + self.assertNotEqual(types_tool.getTypeInfo(module_portal_type), None) + self.assertNotEqual(types_tool.getTypeInfo(object_portal_type), None) + + skin_folder = skins_tool._getOb(portal_skins_folder, None) + self.assertNotEqual(skin_folder, None) + self.assert_('UnitTest_view' in skin_folder.objectIds()) + view_form = skin_folder.UnitTest_view + self.assertEquals('form_view', view_form.pt) + self.assertEquals('Base_edit', view_form.action) + + self.assert_('UnitTestModule_viewUnitTestList' in skin_folder.objectIds()) + list_form = skin_folder.UnitTestModule_viewUnitTestList + self.assertEquals('form_list', list_form.pt) + self.assertEquals('Base_doSelect', list_form.action) + self.assert_('listbox' in [x.getId() for x in list_form.get_fields()]) + self.assert_('listbox' in + [x.getId() for x in list_form.get_fields_in_group('bottom')]) + + # make sure we can use our module + self.portal.unittest_module.view() + self.portal.unittest_module.newContent(id='document', portal_type='UnitTest') + self.portal.unittest_module.document.view() + + def test_02_FavouritesMenu(self, quiet=quiet, run=run_all_test): """ -- 2.30.9