Commit a8e749b6 authored by Julien Muchembled's avatar Julien Muchembled

Stop using transaction.commit and self.stepTic in unit tests

parent 448e5168
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import transaction
from DateTime import DateTime
class TestERP5BearerToken(ERP5TypeTestCase):
......@@ -29,7 +28,6 @@ class TestERP5BearerToken(ERP5TypeTestCase):
person = person_module.newContent(portal_type='Person',
reference='P' + reference)
person.newContent(portal_type = 'Assignment').open()
transaction.commit()
self.tic()
return person
......@@ -39,7 +37,6 @@ class TestERP5BearerToken(ERP5TypeTestCase):
priority=1,
preferred_bearer_token_key=self.test_id)
self.preference.enable()
transaction.commit()
self.tic()
def setupBearerExtraction(self):
......@@ -53,7 +50,7 @@ class TestERP5BearerToken(ERP5TypeTestCase):
('IExtractionPlugin',))
elif len(bearer_extraction_list) > 1:
raise ValueError
transaction.commit()
self.commit()
def afterSetUp(self):
"""
......@@ -64,12 +61,10 @@ class TestERP5BearerToken(ERP5TypeTestCase):
self.person = self.createPerson(self.test_id)
self.setUpBearerTokenKey()
self.setupBearerExtraction()
transaction.commit()
self.tic()
def beforeTearDown(self):
self.portal.portal_preferences.deleteContent(self.preference.getId())
transaction.commit()
self.tic()
def test_working_token(self):
......@@ -94,16 +89,13 @@ class TestERP5BearerToken(ERP5TypeTestCase):
def test_no_bearer_token_key(self):
self.preference.edit(preferred_bearer_token_key='')
transaction.commit()
self.tic()
transaction.commit()
self.assertRaises(ValueError, self.person.Person_getBearerToken)
def test_changed_bearer_token_key(self):
token, expiration_time = self.person.Person_getBearerToken()
self.portal.REQUEST._auth = 'Bearer %s' % token
self.preference.edit(preferred_bearer_token_key='changed')
transaction.commit()
self.tic()
reference = self.getTokenCredential(self.portal.REQUEST)
self.assertEqual(reference, None)
......
10
\ No newline at end of file
11
\ No newline at end of file
......@@ -27,8 +27,6 @@
##############################################################################
import unittest
import transaction
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList
......@@ -345,8 +343,7 @@ class TestNestedLine(TestNestedLineMixin, ERP5TypeTestCase):
set priority=200
where uid <> %s
""" % (table, update_causality_message_uid))
transaction.commit()
self.stepTic(sequence)
self.tic()
@newSimulationExpectedFailure
@expectedFailure
......
......@@ -31,9 +31,6 @@
"""
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript
from AccessControl.SecurityManagement import newSecurityManager
......@@ -951,7 +948,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
self.assertTrue(len(person_module.keys()))
# When we update security of a module...
person_module.reindexObjectSecurity()
transaction.commit()
self.commit()
# we don't want all underlying objects to be recursively
# reindexed. After all, its contents do not acquire local roles.
check(['immediateReindexObject'])
......@@ -963,7 +960,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
for rec in person_module.searchFolder(reference=self.username)]
self.assertTrue(len(person.objectIds()))
person.reindexObjectSecurity()
transaction.commit()
self.commit()
check(['recursiveImmediateReindexObject'])
self.tic()
......
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