From 21222c85b48f1c96c10e1a675187f00bdc228c93 Mon Sep 17 00:00:00 2001
From: Nicolas Dumazet <nicolas.dumazet@nexedi.com>
Date: Mon, 31 Jan 2011 10:17:40 +0000
Subject: [PATCH] this test was only passing due to luck, as destination
 category is manipulated elsewhere.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42801 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/tests/testERP5Type.py | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/product/ERP5Type/tests/testERP5Type.py b/product/ERP5Type/tests/testERP5Type.py
index cdf0909ca5..45bfcf136d 100644
--- a/product/ERP5Type/tests/testERP5Type.py
+++ b/product/ERP5Type/tests/testERP5Type.py
@@ -2399,10 +2399,24 @@ class TestPropertySheet:
     def test_aq_reset_on_portal_types_properties_change(self):
       doc = self.portal.person_module.newContent(portal_type='Person')
       ti = self.getTypesTool()['Person']
-      self.assertFalse(hasattr(doc, 'getDestination'))
-      ti.edit(type_base_category_list=
-        ti.getTypeBaseCategoryList() + ['destination'])
-      self.assertTrue(hasattr(doc, 'getDestination'))
+      base_category_list = ti.getTypeBaseCategoryList()
+      # this test is poorly isolated, and the _19*_ add destination
+      # to the base categories
+      if 'destination' not in base_category_list:
+
+        self.assertFalse(hasattr(doc, 'getDestination'))
+        ti.edit(type_base_category_list=
+          base_category_list + ['destination'])
+
+        transaction.commit()
+        self.assertTrue(hasattr(doc, 'getDestination'))
+      else:
+        self.assertTrue(hasattr(doc, 'getDestination'))
+        base_category_list.remove('destination')
+        ti.edit(type_base_category_list=base_category_list)
+
+        transaction.commit()
+        self.assertFalse(hasattr(doc, 'getDestination'))
 
     def test_aq_reset_on_workflow_chain_change(self):
       doc = self.portal.person_module.newContent(portal_type='Person')
-- 
2.30.9