From 412c7a380a3705a5ac05b7b6149c86b5b6d218de Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Fri, 27 Oct 2006 10:04:18 +0000 Subject: [PATCH] add method to make sure it is impossible to delete objects if there is a problem with the catalog git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10982 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Catalog/tests/testERP5Catalog.py | 23 +++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/product/ERP5Catalog/tests/testERP5Catalog.py b/product/ERP5Catalog/tests/testERP5Catalog.py index 2410b123aa..b18440e10c 100644 --- a/product/ERP5Catalog/tests/testERP5Catalog.py +++ b/product/ERP5Catalog/tests/testERP5Catalog.py @@ -59,7 +59,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): # Different variables used for this test run_all_test = 1 - quiet = 1 + quiet = 0 def afterSetUp(self, quiet=1, run=1): self.login() @@ -789,6 +789,27 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.tic() self.assertNotEquals([], self.getCatalogTool().searchResults( portal_type='Person', title=u'A Person')) + def test_23_DeleteObjectRaiseErrorWhenQueryFail(self, quiet=quiet, run=run_all_test): + if not run: return + if not quiet: + message = 'Test That Delete Object Raise Error When the Query Fail' + ZopeTestCase._print('\n%s ' % message) + LOG('Testing... ',0,message) + portal_catalog = self.getCatalogTool() + person_module = self.getPersonModule() + # Now we will ask to immediatly reindex + person = person_module.newContent(id='2', + portal_type='Person', + immediate_reindex=1) + path_list = [person.getRelativeUrl()] + self.checkRelativeUrlInSqlPathList(path_list) + # We will delete the connector + # in order to make sure it will not work any more + portal = self.getPortal() + portal.manage_delObjects('erp5_sql_connection') + # Then it must be impossible to delete an object + self.assertRaises(AttributeError, person_module.manage_delObjects,'2') + get_transaction().abort() def test_SortOn(self, quiet=quiet, run=run_all_test): if not run: return -- 2.30.9