From 91afdf4ff56fd13ebfd4ae6dd220959aee5e9979 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 27 Oct 2006 14:55:51 +0000
Subject: [PATCH] reset selections before running tests.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10992 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../AccountingZuite_reset.xml                  | 18 ++++++++++++++++--
 bt5/erp5_accounting_ui_test/bt/revision        |  2 +-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reset.xml b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reset.xml
index a54e6fadf9..0c9ca7fd16 100644
--- a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reset.xml
+++ b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reset.xml
@@ -76,7 +76,6 @@
 \n
 # enable preference\n
 pref = portal.portal_preferences.accounting_zuite_preference\n
-\n
 if pref.owner_info()[\'id\'] != str(context.REQUEST.AUTHENTICATED_USER):\n
   # we have to \'own\' the preference for the test\n
   ptool = portal.portal_preferences\n
@@ -86,9 +85,19 @@ if pref.owner_info()[\'id\'] != str(context.REQUEST.AUTHENTICATED_USER):\n
   # as the preference changed, it\'s safer to clear the cache\n
   from Products.ERP5Type.Cache import clearCache\n
   clearCache()\n
-\n
 pref.enable()\n
 \n
+# reset selections\n
+stool = context.getPortalObject().portal_selections\n
+for form in context.getPortalObject().portal_skins\\\n
+                    .erp5_accounting.objectValues(spec=(\'ERP5 Form\',)):\n
+  listbox = getattr(form, \'listbox\', None)\n
+  if listbox is not None:\n
+    stool.setSelectionFor(listbox.get_value(\'selection_name\'), None)\n
+# also reset common selections\n
+stool.setSelectionFor(\'person_selection\', None)\n
+stool.setSelectionFor(\'organisation_selection\', None)\n
+\n
 return "Reset Successfully."\n
 </string> </value>
         </item>
@@ -146,6 +155,11 @@ return "Reset Successfully."\n
                             <string>cb</string>
                             <string>Products.ERP5Type.Cache</string>
                             <string>clearCache</string>
+                            <string>stool</string>
+                            <string>form</string>
+                            <string>getattr</string>
+                            <string>None</string>
+                            <string>listbox</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_accounting_ui_test/bt/revision b/bt5/erp5_accounting_ui_test/bt/revision
index 368f89ceef..d99e90eb96 100644
--- a/bt5/erp5_accounting_ui_test/bt/revision
+++ b/bt5/erp5_accounting_ui_test/bt/revision
@@ -1 +1 @@
-28
\ No newline at end of file
+29
\ No newline at end of file
-- 
2.30.9