Commit d041e861 authored by Julien Muchembled's avatar Julien Muchembled

tests: do not use `transaction` module directly when not necessary

See ERP5 commit 8995b64508f6d7c0fee1ef475de3dc3145ddc84d.
parent dcdf45e3
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
############################################################################## ##############################################################################
import random import random
import transaction
import unittest import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import functools import functools
...@@ -45,7 +44,7 @@ def withAbort(func): ...@@ -45,7 +44,7 @@ def withAbort(func):
try: try:
func(self, *args, **kwargs) func(self, *args, **kwargs)
finally: finally:
transaction.abort() self.abort()
return wrapped return wrapped
class testSlapOSMixin(ERP5TypeTestCase): class testSlapOSMixin(ERP5TypeTestCase):
...@@ -66,7 +65,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -66,7 +65,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.login() self.login()
try: try:
alarm.activeSense(params=kwargs) alarm.activeSense(params=kwargs)
transaction.commit() self.commit()
finally: finally:
setSecurityManager(sm) setSecurityManager(sm)
return callAlarm return callAlarm
...@@ -135,7 +134,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -135,7 +134,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
# Reload promise and include yet another bt5 path. # Reload promise and include yet another bt5 path.
self.loadPromise(searchable_business_template_list=["erp5_core", "erp5_base", "slapos_configurator"]) self.loadPromise(searchable_business_template_list=["erp5_core", "erp5_base", "slapos_configurator"])
self.portal.portal_alarms.promise_template_tool_configuration.solve() self.portal.portal_alarms.promise_template_tool_configuration.solve()
transaction.commit() self.commit()
self.launchConfigurator() self.launchConfigurator()
def afterSetUp(self): def afterSetUp(self):
...@@ -146,7 +145,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -146,7 +145,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
return return
self.portal.portal_caches.erp5_site_global_id = '%s' % random.random() self.portal.portal_caches.erp5_site_global_id = '%s' % random.random()
self.portal.portal_caches._p_changed = 1 self.portal.portal_caches._p_changed = 1
transaction.commit() self.commit()
self.portal.portal_caches.updateCache() self.portal.portal_caches.updateCache()
if getattr(self.portal, 'is_site_bootstrapped', 0): if getattr(self.portal, 'is_site_bootstrapped', 0):
for alarm in self.portal.portal_alarms.contentValues(): for alarm in self.portal.portal_alarms.contentValues():
...@@ -157,7 +156,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -157,7 +156,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.portal.is_site_bootstrapped = 1 self.portal.is_site_bootstrapped = 1
self.bootstrapSite() self.bootstrapSite()
self.portal._p_changed = 1 self.portal._p_changed = 1
transaction.commit() self.commit()
...@@ -165,7 +164,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -165,7 +164,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
if 'MailHost' in self.portal.objectIds(): if 'MailHost' in self.portal.objectIds():
self.portal.manage_delObjects(['MailHost']) self.portal.manage_delObjects(['MailHost'])
self.portal.manage_addProduct['MailHost'].manage_addMailHost('MailHost') self.portal.manage_addProduct['MailHost'].manage_addMailHost('MailHost')
transaction.commit() self.commit()
def setUpPersistentDummyMailHost(self): def setUpPersistentDummyMailHost(self):
if 'MailHost' in self.portal.objectIds(): if 'MailHost' in self.portal.objectIds():
...@@ -189,7 +188,6 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -189,7 +188,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
response_dict = self.portal.portal_configurator._next( response_dict = self.portal.portal_configurator._next(
business_configuration, {}) business_configuration, {})
transaction.commit()
self.tic() self.tic()
self.portal.portal_configurator.startInstallation( self.portal.portal_configurator.startInstallation(
business_configuration,REQUEST=self.portal.REQUEST) business_configuration,REQUEST=self.portal.REQUEST)
...@@ -199,7 +197,6 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -199,7 +197,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.createCertificateAuthorityFile() self.createCertificateAuthorityFile()
self.clearCache() self.clearCache()
transaction.commit()
self.tic() self.tic()
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
...@@ -244,7 +241,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -244,7 +241,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.person_user.validate() self.person_user.validate()
for assignment in self.person_user.contentValues(portal_type="Assignment"): for assignment in self.person_user.contentValues(portal_type="Assignment"):
assignment.open() assignment.open()
transaction.commit() self.commit()
# prepare part of tree # prepare part of tree
self.hosting_subscription = self.portal.hosting_subscription_module\ self.hosting_subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
......
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