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