no more get_transaction(). The transaction module should be used everywhere

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30681 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8f4534fa
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
import unittest import unittest
import transaction
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
...@@ -54,19 +55,19 @@ class TestERP5SocialContracts(ERP5TypeTestCase): ...@@ -54,19 +55,19 @@ class TestERP5SocialContracts(ERP5TypeTestCase):
title='Person3') title='Person3')
def beforeTearDown(self): def beforeTearDown(self):
get_transaction().abort() transaction.begin()
self.portal.person_module.manage_delObjects( self.portal.person_module.manage_delObjects(
list(self.portal.person_module.objectIds())) list(self.portal.person_module.objectIds()))
self.portal.social_contract_module.manage_delObjects( self.portal.social_contract_module.manage_delObjects(
list(self.portal.social_contract_module.objectIds())) list(self.portal.social_contract_module.objectIds()))
get_transaction().commit() transaction.commit()
self.tic() self.tic()
def test_getChildCount(self): def test_getChildCount(self):
self.assertEquals(0, self.person_1.Person_getChildCount()) self.assertEquals(0, self.person_1.Person_getChildCount())
self.person_2.setNaturalParentValue(self.person_1) self.person_2.setNaturalParentValue(self.person_1)
get_transaction().commit() transaction.commit()
self.tic() self.tic()
self.assertEquals(1, self.person_1.Person_getChildCount()) self.assertEquals(1, self.person_1.Person_getChildCount())
...@@ -82,7 +83,7 @@ class TestERP5SocialContracts(ERP5TypeTestCase): ...@@ -82,7 +83,7 @@ class TestERP5SocialContracts(ERP5TypeTestCase):
start_date='2001-01-01') start_date='2001-01-01')
contract_1.setDestinationValueList((self.person_1, self.person_2)) contract_1.setDestinationValueList((self.person_1, self.person_2))
contract_1.validate() contract_1.validate()
get_transaction().commit() transaction.commit()
self.tic() self.tic()
self.assertEquals(1, self.person_1.Person_getPartnerCount()) self.assertEquals(1, self.person_1.Person_getPartnerCount())
...@@ -93,7 +94,7 @@ class TestERP5SocialContracts(ERP5TypeTestCase): ...@@ -93,7 +94,7 @@ class TestERP5SocialContracts(ERP5TypeTestCase):
contract_2.setStopDate('3000-01-01') contract_2.setStopDate('3000-01-01')
contract_2.validate() contract_2.validate()
get_transaction().commit() transaction.commit()
self.tic() self.tic()
self.assertEquals(2, self.person_1.Person_getPartnerCount()) self.assertEquals(2, self.person_1.Person_getPartnerCount())
......
14 15
\ No newline at end of file \ No newline at end of file
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