Commit 66845855 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Unit Tests: login*() with a non-ERP5TypeTestCase user was adding...

Unit Tests: login*() with a non-ERP5TypeTestCase user was adding ERP5TypeTestCase user anyway and failure was silently ignored.
parent 7c0f804d
......@@ -258,24 +258,28 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
try:
PortalTestCase.login(self, user_name)
except AttributeError:
self.addERP5TypeTestCaseUser()
return PortalTestCase.login(self, user_name)
if user_name == 'ERP5TypeTestCase':
self.addERP5TypeTestCaseUser()
return PortalTestCase.login(self, user_name)
else:
raise
def loginByUserName(self, user_name='ERP5TypeTestCase', quiet=0):
"""
Most of the time, we need to login before doing anything
"""
uf = self.portal.acl_users
for i in range(2):
try:
user = uf.getUser(user_name)
if user is None:
if user_name == 'ERP5TypeTestCase':
self.addERP5TypeTestCaseUser(password='', user_folder=uf)
user = uf.getUser(user_name)
if not hasattr(user, 'aq_base'):
user = user.__of__(uf)
newSecurityManager(None, user)
return
except AttributeError:
uf._doAddUser('ERP5TypeTestCase', '', ['Manager', 'Member', 'Assignee',
'Assignor', 'Author', 'Auditor', 'Associate'], [])
else:
raise RuntimeError("Could not find username '%s'" % user_name)
if not hasattr(user, 'aq_base'):
user = user.__of__(uf)
newSecurityManager(None, user)
def changeSkin(self, skin_name):
"""
......
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