From a4bc0cfef8dfda4b6f3971a5259283e05c4bd9e7 Mon Sep 17 00:00:00 2001 From: Gabriel Monnerat <gabriel@tiolive.com> Date: Mon, 28 Feb 2011 18:36:24 +0000 Subject: [PATCH] - add asserts - clean up the code in script git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43828 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_web_ung_theme/WebSection_deleteObjectList.xml | 7 +++---- bt5/erp5_web_ung_theme/TestTemplateItem/testUNG.py | 8 +++++++- bt5/erp5_web_ung_theme/bt/revision | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_deleteObjectList.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_deleteObjectList.xml index bc23024903..827c5319f0 100644 --- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_deleteObjectList.xml +++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_deleteObjectList.xml @@ -50,10 +50,9 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>portal_type_list = ["Web Page", "Web Table", "Web Illustration"]\n + <value> <string>portal_type_list = ["Web Page", "Web Table", "Web Illustration", "Email Thread"]\n \n portal = context.getPortalObject()\n -website_url = context.absolute_url()\n uid_list = context.REQUEST.get("uids")\n \n if uid_list is not None:\n @@ -61,8 +60,8 @@ if uid_list is not None:\n uid=uid_list):\n object = context.restrictedTraverse(catalog_object.getPath())\n if object.getValidationState() == "deleted":\n - portal.web_page_module.deleteContent(object.getId())\n - continue\n + parent_folder = object.getParent()\n + parent_folder.deleteContent(object.getId())\n else:\n object.delete()\n \n diff --git a/bt5/erp5_web_ung_theme/TestTemplateItem/testUNG.py b/bt5/erp5_web_ung_theme/TestTemplateItem/testUNG.py index 7ce5b3dcdc..97dca22101 100644 --- a/bt5/erp5_web_ung_theme/TestTemplateItem/testUNG.py +++ b/bt5/erp5_web_ung_theme/TestTemplateItem/testUNG.py @@ -133,8 +133,14 @@ class TestUNG(ERP5TypeTestCase): def testWebSection_deleteObjectList(self): """Test if objects are deleted correctly""" web_page = self.portal.web_page_module.newContent(portal_type="Web Page") + relative_url = web_page.getRelativeUrl() self.portal.REQUEST.set("uids", [web_page.getUid(),]) self.stepTic() self.portal.WebSection_deleteObjectList() self.stepTic() - self.assertEquals(web_page.getValidationState(), "deleted") \ No newline at end of file + self.assertEquals(web_page.getValidationState(), "deleted") + self.portal.REQUEST.set("uids", [web_page.getUid(),]) + self.stepTic() + self.portal.WebSection_deleteObjectList() + self.stepTic() + self.assertEquals(len(self.portal.portal_catalog(relative_url=relative_url)), 0) diff --git a/bt5/erp5_web_ung_theme/bt/revision b/bt5/erp5_web_ung_theme/bt/revision index 99bc3d5186..dd4a90065c 100644 --- a/bt5/erp5_web_ung_theme/bt/revision +++ b/bt5/erp5_web_ung_theme/bt/revision @@ -1 +1 @@ -253 \ No newline at end of file +254 \ No newline at end of file -- 2.30.9