From ff802bfdfcd5f4a54e4219032f63c9364af6a12c Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Sat, 12 Feb 2011 09:04:43 +0000
Subject: [PATCH] try to clean up more in beforeTearDown().

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43294 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testBusinessTemplate.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py
index 55a32b6212..cc2628a5a7 100644
--- a/product/ERP5/tests/testBusinessTemplate.py
+++ b/product/ERP5/tests/testBusinessTemplate.py
@@ -190,6 +190,24 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
     for business_template in self.getTemplateTool().contentValues():
       if business_template.getTitle() == 'geek template':
         self.getTemplateTool().manage_delObjects([business_template.getId()])
+    self.stepRemoveAllTrashBins()
+    catalog = self.portal.portal_catalog.erp5_mysql_innodb
+    for method_id in ('z_fake_method', 'z_another_fake_method'):
+      if method_id in catalog.objectIds():
+        catalog.manage_delObjects(['z_fake_method'])
+      sql_uncatalog_object = list(catalog.sql_uncatalog_object)
+      if method_id in sql_uncatalog_object:
+        sql_uncatalog_object.remove(method_id)
+        sql_uncatalog_object.sort()
+        catalog.sql_uncatalog_object = tuple(sql_uncatalog_object)
+      if method_id in catalog.filter_dict:
+        del catalog.filter_dict[method_id]
+    if 'another_file' in self.portal.objectIds():
+      self.portal.manage_delObjects(['another_file'])
+    property_sheet_tool = self.getPortalObject().portal_property_sheets
+    for property_sheet in ('UnitTest',):
+      if property_sheet in property_sheet_tool.objectIds():
+        property_sheet_tool.manage_delObjects([property_sheet])
     transaction.commit()
     self._ignore_log_errors()
 
-- 
2.30.9