From a4c7c670e6be64c4f7c6212ca433525975e0e063 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Thu, 12 Feb 2009 10:01:16 +0000
Subject: [PATCH] disable existing User preferences before tests that create a
 new User preference.

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

diff --git a/product/ERP5/tests/testAccounting.py b/product/ERP5/tests/testAccounting.py
index db7b39a6a4..ce54441343 100644
--- a/product/ERP5/tests/testAccounting.py
+++ b/product/ERP5/tests/testAccounting.py
@@ -3598,7 +3598,14 @@ class TestAccountingTransactionTemplate(AccountingTestCase):
   def getTitle(self):
     return "Accounting Transaction Template"
 
+  def disableUserPreferenceList(self):
+    """Disable existing User preferences."""
+    for preference in self.portal.portal_preferences.objectValues():
+      if preference.getPriority() == Priority.USER:
+        preference.disable()
+
   def test_Template(self):
+    self.disableUserPreferenceList()
     self.login('claudie')
     preference = self.portal.portal_preferences.newContent('Preference')
     preference.priority = Priority.USER
@@ -3643,6 +3650,7 @@ class TestAccountingTransactionTemplate(AccountingTestCase):
   def test_Base_doAction(self):
     # test creating a template using Base_doAction script (this is what
     # erp5_xhtml_style does)
+    self.disableUserPreferenceList()
     self.login('claudie')
     preference = self.portal.portal_preferences.newContent('Preference')
     preference.priority = Priority.USER
-- 
2.30.9