[Erp5-report] r26981 - /erp5/trunk/products/ERP5Form/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu May 14 14:00:31 CEST 2009


Author: jerome
Date: Thu May 14 14:00:29 2009
New Revision: 26981

URL: http://svn.erp5.org?rev=26981&view=rev
Log:
get_transaction -> transaction

Modified:
    erp5/trunk/products/ERP5Form/tests/testGUIwithSecurity.py
    erp5/trunk/products/ERP5Form/tests/testListBox.py
    erp5/trunk/products/ERP5Form/tests/testOOoChart.py
    erp5/trunk/products/ERP5Form/tests/testPreferences.py
    erp5/trunk/products/ERP5Form/tests/testSelectionTool.py

Modified: erp5/trunk/products/ERP5Form/tests/testGUIwithSecurity.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/tests/testGUIwithSecurity.py?rev=26981&r1=26980&r2=26981&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/tests/testGUIwithSecurity.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/tests/testGUIwithSecurity.py [utf8] Thu May 14 14:00:29 2009
@@ -29,6 +29,7 @@
 
 
 import unittest
+import transaction
 
 from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
 from AccessControl.SecurityManagement import newSecurityManager
@@ -85,12 +86,12 @@
       asg.setStartDate(DateTime() - 100)
       asg.setStopDate(DateTime() + 100)
       asg.open()
-    get_transaction().commit()
+    transaction.commit()
 
   def stepCreateTestFoo(self, sequence = None, sequence_list = None, **kw):
     foo_module = self.getPortal().foo_module
     foo_module.newContent(portal_type='Foo', id='foo', foo_category='a')
-    get_transaction().commit()
+    transaction.commit()
 
   def stepAccessFoo(self, sequence = None, sequence_list = None, **kw):
     """
@@ -109,7 +110,7 @@
     args = (('Manager',), 0)
     category.manage_permission('Access contents information', *args)
     category.manage_permission('View', *args)
-    get_transaction().commit()
+    transaction.commit()
     self.tic()
 
   def stepResetCategorySecurity(self, sequence = None, sequence_list = None, **kw):
@@ -120,7 +121,7 @@
     args = ((), 1)
     category.manage_permission('Access contents information', *args)
     category.manage_permission('View', *args)
-    get_transaction().commit()
+    transaction.commit()
     self.tic()
 
   def test_01_relationFieldToInaccessibleObject(self, quiet=quiet, run=run_all_test):

Modified: erp5/trunk/products/ERP5Form/tests/testListBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/tests/testListBox.py?rev=26981&r1=26980&r2=26981&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/tests/testListBox.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/tests/testListBox.py [utf8] Thu May 14 14:00:29 2009
@@ -29,6 +29,7 @@
 
 import unittest
 
+import transaction
 from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
 from AccessControl.SecurityManagement import newSecurityManager
 from zLOG import LOG
@@ -258,7 +259,7 @@
     request.form['my_file_upload'] = FileUpload(DummyFieldStorage())
     listbox.get_value('default', render_format='list', REQUEST=request)
     try:
-      get_transaction().commit()
+      transaction.commit()
     except TypeError, e:
       self.fail('Unable to commit transaction: %s' % e)
 

Modified: erp5/trunk/products/ERP5Form/tests/testOOoChart.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/tests/testOOoChart.py?rev=26981&r1=26980&r2=26981&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/tests/testOOoChart.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/tests/testOOoChart.py [utf8] Thu May 14 14:00:29 2009
@@ -26,6 +26,7 @@
 ##############################################################################
 
 import unittest
+import transaction
 from Products.ERP5Form.Form import ERP5Form
 from DocumentTemplate import String
 
@@ -99,7 +100,7 @@
                                             wf_id='preference_workflow')
 
       self.validator = Validator()
-      get_transaction().commit()
+      transaction.commit()
       self.tic()
 
     def createPersons(self):

Modified: erp5/trunk/products/ERP5Form/tests/testPreferences.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/tests/testPreferences.py?rev=26981&r1=26980&r2=26981&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/tests/testPreferences.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/tests/testPreferences.py [utf8] Thu May 14 14:00:29 2009
@@ -28,6 +28,7 @@
 
 import unittest
 
+import transaction
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
 from AccessControl.SecurityManagement import getSecurityManager
@@ -57,7 +58,7 @@
   def beforeTearDown(self):
     portal_preferences = self.getPreferenceTool()
     portal_preferences.manage_delObjects(list(portal_preferences.objectIds()))
-    get_transaction().commit()
+    transaction.commit()
     self.tic()
 
   def createPreferences(self) :
@@ -76,7 +77,7 @@
     site.setPriority(Priority.SITE)
     
     # commit transaction
-    get_transaction().commit()
+    transaction.commit()
     self.getPreferenceTool().recursiveReindexObject()
     self.tic()
     
@@ -299,7 +300,7 @@
         id='user_a_1', portal_type='Preference')
     user_a_2 = portal_preferences.newContent(
         id='user_a_2', portal_type='Preference')
-    get_transaction().commit(); self.tic()
+    transaction.commit(); self.tic()
 
     # enable a pref
     portal_workflow.doActionFor(
@@ -314,7 +315,7 @@
     user_b_1 = portal_preferences.newContent(
         id='user_b_1', portal_type='Preference')
     user_b_1.setPreferredAccountingTransactionAtDate(DateTime(2002, 02, 02))
-    get_transaction().commit(); self.tic()
+    transaction.commit(); self.tic()
     
     # enable this preference
     portal_workflow.doActionFor(
@@ -338,7 +339,7 @@
         id='manager_pref', portal_type='Preference')
     manager_pref.setPreferredAccountingTransactionAtDate(
                                 DateTime(2012, 12, 12))
-    get_transaction().commit(); self.tic()
+    transaction.commit(); self.tic()
     # enable this preference
     portal_workflow.doActionFor(
        manager_pref, 'enable_action', wf_id='preference_workflow')
@@ -357,7 +358,7 @@
     self.getPortal().portal_workflow.doActionFor(
                   ptool.site, 'enable_action', wf_id='preference_workflow')
     self.assertEquals('global', ptool.site.getPreferenceState())
-    get_transaction().commit()
+    transaction.commit()
     self.tic()
     noSecurityManager()
     self.assertEquals(['this_is_visible_by_anonymous'],
@@ -441,7 +442,7 @@
     # enable it and check preference is returned
     self.portal.portal_workflow.doActionFor(site_pref, 'enable_action')
     self.assertEquals(site_pref.getPreferenceState(), 'global')
-    get_transaction().commit()
+    transaction.commit()
     self.tic()
     self.assertEquals(['this_is_default'],
                       preference_tool.getPreferredAccountingTransactionSimulationStateList())
@@ -457,7 +458,7 @@
     # check accessors works
     site_pref.setPreferredAccountingTransactionSimulationStateList(
       ['this_is_system'])
-    get_transaction().commit()
+    transaction.commit()
     self.tic()
     self.assertEquals(['this_is_system'],
                       preference_tool.getPreferredAccountingTransactionSimulationStateList())
@@ -471,7 +472,7 @@
       ['this_is_user'])
     self.portal.portal_workflow.doActionFor(user_pref, 'enable_action')
     self.assertEquals(user_pref.getPreferenceState(), 'enabled')
-    get_transaction().commit()
+    transaction.commit()
     self.tic()
     self.assertEquals(['this_is_user'],
                       user_pref.getPreferredAccountingTransactionSimulationStateList())
@@ -481,7 +482,7 @@
     # check a user can't edit preference which are marked for manager (only for zope2.8)
     try:
       from ZODB.Transaction import Transaction
-    except ImportError:      
+    except ImportError:
       self.assertRaises(Unauthorized, user_pref.edit, preferred_ooodoc_server_address="localhost")
 
     

Modified: erp5/trunk/products/ERP5Form/tests/testSelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/tests/testSelectionTool.py?rev=26981&r1=26980&r2=26981&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/tests/testSelectionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/tests/testSelectionTool.py [utf8] Thu May 14 14:00:29 2009
@@ -30,6 +30,7 @@
 from threading import Thread
 from thread import get_ident
 
+import transaction
 from Testing import ZODButil
 
 from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
@@ -243,7 +244,7 @@
     self.portal_selections = \
       self.cnx.root().portal_selections = SelectionTool()
     self.portal_selections.setSelectionFor('test_selection', Selection())
-    get_transaction().commit()
+    transaction.commit()
     
   def tearDown(self):
     # revert the patch from setUp
@@ -271,13 +272,13 @@
         portal_selections = cnx.root().portal_selections
         portal_selections.setSelectionParamsFor(
                               'test_selection', dict(a="c"))
-        get_transaction().commit()
+        transaction.commit()
       finally:
         cnx.close()
     self._runWithAnotherConnection(thread_func)
 
     # This would raise a ConflictError without conflict resolution code
-    get_transaction().commit()
+    transaction.commit()
     params = self.portal_selections.getSelectionParamsFor('test_selection')
     self.assertTrue(params.get('a'))
 
@@ -290,13 +291,13 @@
         portal_selections = cnx.root().portal_selections
         portal_selections.setSelectionParamsFor(
                        'test_selection1', dict(a="b"))
-        get_transaction().commit()
+        transaction.commit()
       finally:
         cnx.close()
     self._runWithAnotherConnection(thread_func)
 
     # This would raise a ConflictError without conflict resolution code
-    get_transaction().commit()
+    transaction.commit()
     params = self.portal_selections.getSelectionParamsFor('test_selection1')
     self.assertEquals(params.get('a'), 'b')
     params = self.portal_selections.getSelectionParamsFor('test_selection2')
@@ -313,7 +314,7 @@
     # So we make sure that selection container is initialized for this user
     self.portal_selections.setSelectionParamsFor(
                        'test_selection', dict(initialized="1"))
-    get_transaction().commit()
+    transaction.commit()
 
     self.portal_selections.setSelectionParamsFor(
                        'test_selection', dict(a="b"))
@@ -322,12 +323,12 @@
         portal_selections = cnx.root().portal_selections
         portal_selections.setSelectionParamsFor(
                        'test_selection', dict(a="b"))
-        get_transaction().commit()
+        transaction.commit()
       finally:
         cnx.close()
     self._runWithAnotherConnection(thread_func)
 
-    get_transaction().commit()
+    transaction.commit()
     # this check is quite low level.
     # we know that setUp stored one selection, and each of our 2 threads stored
     # one selection.
@@ -337,7 +338,7 @@
     # test that selection parameters are persistent
     self.portal_selections.setSelectionParamsFor(
                  'test_selection', dict(key="saved_value"))
-    get_transaction().commit()
+    transaction.commit()
     self.cnx.close()
 
     self.cnx = self.db.open()




More information about the Erp5-report mailing list