Commit 2334b52a authored by Vincent Pelletier's avatar Vincent Pelletier

Get rid of some more get_transaction().


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44581 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f872b22f
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from transaction import get as get_transaction import transaction
def isSameSet(a, b): def isSameSet(a, b):
for i in a: for i in a:
...@@ -154,7 +154,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase): ...@@ -154,7 +154,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
if self.PAS_installed: if self.PAS_installed:
# reindexing is required for the security to work # reindexing is required for the security to work
get_transaction().commit() transaction().commit()
self.tic() self.tic()
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
# import requested python module # import requested python module
import os import os
import transaction
from zLOG import LOG from zLOG import LOG
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
...@@ -292,7 +293,7 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin): ...@@ -292,7 +293,7 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin):
self.workflow_tool.doActionFor(new_payment, 'plan_action', self.workflow_tool.doActionFor(new_payment, 'plan_action',
wf_id='check_payment_workflow') wf_id='check_payment_workflow')
self.assertEqual(new_payment.getSimulationState(), 'planned') self.assertEqual(new_payment.getSimulationState(), 'planned')
get_transaction().commit() transaction().commit()
if will_fail: if will_fail:
message = self.assertWorkflowTransitionFails(new_payment, message = self.assertWorkflowTransitionFails(new_payment,
'check_payment_workflow', 'confirm_action') 'check_payment_workflow', 'confirm_action')
...@@ -302,7 +303,7 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin): ...@@ -302,7 +303,7 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin):
if insuffisient_balance: if insuffisient_balance:
self.assertTrue(message.find('Bank account is not sufficient')>=0) self.assertTrue(message.find('Bank account is not sufficient')>=0)
self.assertEqual(new_payment.getSimulationState(), 'planned') self.assertEqual(new_payment.getSimulationState(), 'planned')
get_transaction().commit() transaction().commit()
self.workflow_tool.doActionFor(new_payment, 'reject_action', self.workflow_tool.doActionFor(new_payment, 'reject_action',
wf_id='check_payment_workflow') wf_id='check_payment_workflow')
self.workflow_tool.doActionFor(new_payment, 'cancel_action', self.workflow_tool.doActionFor(new_payment, 'cancel_action',
...@@ -313,7 +314,7 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin): ...@@ -313,7 +314,7 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin):
new_payment, 'confirm_action', new_payment, 'confirm_action',
wf_id='check_payment_workflow') wf_id='check_payment_workflow')
self.assertEqual(new_payment.getSimulationState(), 'confirmed') self.assertEqual(new_payment.getSimulationState(), 'confirmed')
get_transaction().commit() transaction().commit()
if check_pay_will_fail: if check_pay_will_fail:
self.stepInputCashDetails(check_payment=new_payment) self.stepInputCashDetails(check_payment=new_payment)
message = self.assertWorkflowTransitionFails(new_payment, message = self.assertWorkflowTransitionFails(new_payment,
......
...@@ -33,7 +33,7 @@ from Products.ERP5Type.tests.Sequence import SequenceList ...@@ -33,7 +33,7 @@ from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Banking.tests.testERP5BankingCheckbookUsualCashTransfer \ from Products.ERP5Banking.tests.testERP5BankingCheckbookUsualCashTransfer \
import TestERP5BankingCheckbookUsualCashTransferMixin import TestERP5BankingCheckbookUsualCashTransferMixin
from Products.ERP5Banking.tests.TestERP5BankingMixin import TestERP5BankingMixin from Products.ERP5Banking.tests.TestERP5BankingMixin import TestERP5BankingMixin
from transaction import get as get_transaction import transaction
# Needed in order to have a log file inside the current folder # Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log') os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
...@@ -119,7 +119,7 @@ class TestERP5BankingCheckbookDeliveryMixin(TestERP5BankingMixin): ...@@ -119,7 +119,7 @@ class TestERP5BankingCheckbookDeliveryMixin(TestERP5BankingMixin):
# in the source # in the source
self.createCheckbookReception() self.createCheckbookReception()
self.checkItemsCreated() self.checkItemsCreated()
get_transaction().commit() transaction().commit()
self.tic() self.tic()
self.createCheckbookVaultTransfer() self.createCheckbookVaultTransfer()
......
...@@ -34,7 +34,7 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed ...@@ -34,7 +34,7 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Banking.tests.testERP5BankingCheckbookVaultTransfer \ from Products.ERP5Banking.tests.testERP5BankingCheckbookVaultTransfer \
import TestERP5BankingCheckbookVaultTransferMixin import TestERP5BankingCheckbookVaultTransferMixin
from zLOG import LOG from zLOG import LOG
from transaction import get as get_transaction import transaction
# Needed in order to have a log file inside the current folder # Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log') os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
...@@ -177,7 +177,7 @@ class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCas ...@@ -177,7 +177,7 @@ class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCas
# in the source # in the source
self.createCheckbookReception() self.createCheckbookReception()
self.checkItemsCreated() self.checkItemsCreated()
get_transaction().commit() transaction().commit()
self.tic() self.tic()
self.createCheckbookVaultTransfer() self.createCheckbookVaultTransfer()
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
import os import os
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Banking.tests.TestERP5BankingMixin import TestERP5BankingMixin from Products.ERP5Banking.tests.TestERP5BankingMixin import TestERP5BankingMixin
from transaction import get as get_transaction import transaction
# Needed in order to have a log file inside the current folder # Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log') os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
...@@ -71,7 +71,7 @@ class TestERP5BankingCheckbookVaultTransferMixin(TestERP5BankingMixin): ...@@ -71,7 +71,7 @@ class TestERP5BankingCheckbookVaultTransferMixin(TestERP5BankingMixin):
wf_id='checkbook_reception_workflow') wf_id='checkbook_reception_workflow')
self.workflow_tool.doActionFor(self.checkbook_reception, 'deliver_action', self.workflow_tool.doActionFor(self.checkbook_reception, 'deliver_action',
wf_id='checkbook_reception_workflow') wf_id='checkbook_reception_workflow')
get_transaction().commit() transaction().commit()
self.tic() self.tic()
def createCheckbookReceptionWithTravelerCheck(self, sequence=None, def createCheckbookReceptionWithTravelerCheck(self, sequence=None,
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
# import requested python module # import requested python module
import os import os
import transaction
from zLOG import LOG from zLOG import LOG
from DateTime import DateTime from DateTime import DateTime
from Testing import ZopeTestCase from Testing import ZopeTestCase
...@@ -76,7 +77,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin): ...@@ -76,7 +77,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin):
self.login('super_user') self.login('super_user')
counter_date_module = self.getPortal().counter_date_module counter_date_module = self.getPortal().counter_date_module
counter_date_module.manage_delObjects(ids=[x for x in counter_date_module.objectIds()]) counter_date_module.manage_delObjects(ids=[x for x in counter_date_module.objectIds()])
get_transaction().commit() transaction().commit()
self.tic() self.tic()
def openCounterDate(self, date=None, site=None, id='counter_date_1', open=True, force_check=0): def openCounterDate(self, date=None, site=None, id='counter_date_1', open=True, force_check=0):
...@@ -112,7 +113,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin): ...@@ -112,7 +113,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin):
ZopeTestCase._print('\n%s ' % message) ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ', 0, message) LOG('Testing... ', 0, message)
self.openCounterDate(site=self.paris, id='counter_date_1') self.openCounterDate(site=self.paris, id='counter_date_1')
get_transaction().commit() transaction().commit()
self.tic() self.tic()
self.openCounterDate(site=self.paris, id='counter_date_2', open=0) self.openCounterDate(site=self.paris, id='counter_date_2', open=0)
# open counter date and counter # open counter date and counter
...@@ -180,7 +181,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin): ...@@ -180,7 +181,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin):
counter_date = getattr(self, id) counter_date = getattr(self, id)
self.assertEquals(counter_date.getReference(), reference) self.assertEquals(counter_date.getReference(), reference)
counter_date.close() counter_date.close()
get_transaction().commit() transaction().commit()
self.tic() self.tic()
# Starts at one # Starts at one
...@@ -189,12 +190,12 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin): ...@@ -189,12 +190,12 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin):
openAndTest(self.paris, DateTime('2008/01/02'), '2') openAndTest(self.paris, DateTime('2008/01/02'), '2')
# Monotonous: create one but leave it in draft, check same day # Monotonous: create one but leave it in draft, check same day
self.openCounterDate(site=self.paris, id='counter_date_2008_01_03_paris_draft', date=DateTime('2008/01/03'), open=0) self.openCounterDate(site=self.paris, id='counter_date_2008_01_03_paris_draft', date=DateTime('2008/01/03'), open=0)
get_transaction().commit() transaction().commit()
self.tic() self.tic()
openAndTest(self.paris, DateTime('2008/01/03'), '3') openAndTest(self.paris, DateTime('2008/01/03'), '3')
# Monotonous: create one but leave it in draft, check next day # Monotonous: create one but leave it in draft, check next day
self.openCounterDate(site=self.paris, id='counter_date_2008_01_04_paris_draft', date=DateTime('2008/01/04'), open=0) self.openCounterDate(site=self.paris, id='counter_date_2008_01_04_paris_draft', date=DateTime('2008/01/04'), open=0)
get_transaction().commit() transaction().commit()
self.tic() self.tic()
openAndTest(self.paris, DateTime('2008/01/05'), '4') openAndTest(self.paris, DateTime('2008/01/05'), '4')
# Site-scoped # Site-scoped
...@@ -216,7 +217,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin): ...@@ -216,7 +217,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin):
ZopeTestCase._print('\n%s ' % message) ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ', 0, message) LOG('Testing... ', 0, message)
self.openCounterDate(site=self.paris, id='counter_date_1') self.openCounterDate(site=self.paris, id='counter_date_1')
get_transaction().commit() transaction().commit()
self.openCounterDate(site=self.paris, id='counter_date_2', open=0) self.openCounterDate(site=self.paris, id='counter_date_2', open=0)
# open counter date and counter # open counter date and counter
self.assertRaises(ValidationFailed, self.assertRaises(ValidationFailed,
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
# import requested python module # import requested python module
import os import os
import transaction
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Banking.tests.testERP5BankingCheckbookUsualCashTransfer \ from Products.ERP5Banking.tests.testERP5BankingCheckbookUsualCashTransfer \
import TestERP5BankingCheckbookUsualCashTransferMixin import TestERP5BankingCheckbookUsualCashTransferMixin
...@@ -143,19 +144,19 @@ class TestERP5BankingTravelerCheckSaleMixin(TestERP5BankingMixin): ...@@ -143,19 +144,19 @@ class TestERP5BankingTravelerCheckSaleMixin(TestERP5BankingMixin):
# in the source # in the source
self.traveler_check_model = self.createTravelerCheckModel('traveler_check_model') self.traveler_check_model = self.createTravelerCheckModel('traveler_check_model')
self.createCheckbookReceptionWithTravelerCheck() self.createCheckbookReceptionWithTravelerCheck()
get_transaction().commit() transaction().commit()
self.tic() self.tic()
self.checkItemsCreatedWithTravelerCheck() self.checkItemsCreatedWithTravelerCheck()
get_transaction().commit() transaction().commit()
self.tic() self.tic()
self.createCheckbookVaultTransferWithTravelerCheck() self.createCheckbookVaultTransferWithTravelerCheck()
get_transaction().commit() transaction().commit()
self.tic() self.tic()
# open counter date and counter # open counter date and counter
self.openCounterDate(site=self.paris) self.openCounterDate(site=self.paris)
self.openCounter(site=self.destination_site) self.openCounter(site=self.destination_site)
self.createCheckbookUsualCashTransferWithTravelerCheck() self.createCheckbookUsualCashTransferWithTravelerCheck()
get_transaction().commit() transaction().commit()
self.tic() self.tic()
def stepCreateTravelerCheckLineList(self, sequence=None, sequence_list=None, **kwd): def stepCreateTravelerCheckLineList(self, sequence=None, sequence_list=None, **kwd):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment