Commit 205ccd98 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Migrate test to Live Test.

In Live Test, setUpOnce() is not called, instead afterSetUp() should be
used. Also, remove update of Local Roles as this is already done automatically
upon bt5 installation since a481170a.
parent 3a92d8b6
......@@ -9,12 +9,10 @@ class TestDiscussionThread(SecurityTestCase):
def getTitle(self):
return "TestDiscussionThread"
def setUpOnce(self):
def afterSetUp(self):
"""
Create users to interact with the discussion forums
This is ran only once
This is ran before each and every test, used to set up the environment
"""
self.portal.portal_types['Person Module'].updateRoleMapping()
user_list = [
# This is Dictator, a user of our portal and a forum admin
dict(title='Dictator', reference='admin', function='forum/administrator'),
......@@ -31,10 +29,9 @@ class TestDiscussionThread(SecurityTestCase):
for user in user_list:
self.createSimpleUser(**user)
def afterSetUp(self):
"""
This is ran before each and every test, used to set up the environment
"""
self.commit()
self.tic()
self.forum_module = self.portal.getDefaultModule(portal_type='Discussion Thread')
self.assertTrue(self.forum_module is not None)
......
2013-09-09 arnaud.fontaine
* ZODB Components: Migrate bt5 test to Live Test.
2013-09-08 arnaud.fontaine
* ZODB Components: Revert 'Allow to execute runUnitTest for bt5 Test Components' to fix tests bootstrap.
......
8
\ No newline at end of file
9
\ No newline at end of file
......@@ -99,6 +99,16 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
# pass
# #self.REQUEST.other.pop(key, None) # XXX
def createSimpleUser(self, title, reference, *args, **kwargs):
"""
Convenient helper to avoid recreating user every time (in non-Live Test, data
is not kept and usually these users are only created in setUpOnce() (not
used in favor of afterSetUp() in Live Tests)
"""
if not self.portal.acl_users.getUserById(reference):
return super(ERP5TypeLiveTestCase,
self).createSimpleUser(title, reference, *args, **kwargs)
def _close(self):
'''Closes the ZODB connection.'''
revert = transaction.get().__hash__() != self.initial_transaction_hash
......
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