Commit 52f21b9b authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fixup! test: migrate to ERP5 Login authentication.

parent 26e20e2d
...@@ -12,7 +12,6 @@ if person is None: ...@@ -12,7 +12,6 @@ if person is None:
title=functional_test_username) title=functional_test_username)
person.edit(reference=functional_test_username, person.edit(reference=functional_test_username,
password=howto_dict['functional_test_user_password'],
default_email_text=howto_dict['functional_test_user_email']) default_email_text=howto_dict['functional_test_user_email'])
person.validate() person.validate()
...@@ -23,6 +22,13 @@ if person is None: ...@@ -23,6 +22,13 @@ if person is None:
function='company/manager') function='company/manager')
assignment.open() assignment.open()
login = person.newContent(
portal_type='ERP5 Login',
reference=functional_test_username,
password=howto_dict['functional_test_user_password'],
)
login.validate()
# XXX (lucas): These tests must be able to run on an instance without security. # XXX (lucas): These tests must be able to run on an instance without security.
for role in ('Assignee', 'Assignor', 'Associate', 'Auditor', 'Owner'): for role in ('Assignee', 'Assignor', 'Associate', 'Auditor', 'Owner'):
portal.acl_users.zodb_roles.assignRoleToPrincipal(role, functional_test_username) portal.acl_users.zodb_roles.assignRoleToPrincipal(role, functional_test_username)
......
...@@ -12,7 +12,6 @@ if person is None: ...@@ -12,7 +12,6 @@ if person is None:
title=functional_test_username) title=functional_test_username)
person.edit(reference=functional_test_username, person.edit(reference=functional_test_username,
password=howto_dict['functional_test_user_password'],
default_email_text=howto_dict['functional_test_user_email']) default_email_text=howto_dict['functional_test_user_email'])
person.validate() person.validate()
...@@ -23,6 +22,13 @@ if person is None: ...@@ -23,6 +22,13 @@ if person is None:
function='company/manager') function='company/manager')
assignment.open() assignment.open()
login = person.newContent(
portal_type='ERP5 Login',
reference=functional_test_username,
password=howto_dict['functional_test_user_password'],
)
login.validate()
# XXX (lucas): These tests must be able to run on an instance without security. # XXX (lucas): These tests must be able to run on an instance without security.
for role in ('Assignee', 'Assignor', 'Associate', 'Auditor', 'Owner'): for role in ('Assignee', 'Assignor', 'Associate', 'Auditor', 'Owner'):
portal.acl_users.zodb_roles.assignRoleToPrincipal(role, functional_test_username) portal.acl_users.zodb_roles.assignRoleToPrincipal(role, functional_test_username)
......
...@@ -11,10 +11,15 @@ else: ...@@ -11,10 +11,15 @@ else:
person = person_module.newContent(portal_type="Person", person = person_module.newContent(portal_type="Person",
reference=user_id, reference=user_id,
id=user_id, id=user_id,
password=new_password,
default_email_text="userA@example.invalid") default_email_text="userA@example.invalid")
assignment = person.newContent(portal_type='Assignment') assignment = person.newContent(portal_type='Assignment')
assignment.open() assignment.open()
login = person.newContent(
portal_type='ERP5 Login',
reference=user_id,
password=new_password,
)
login.validate()
# Make sure always a new password # Make sure always a new password
person.setPassword(new_password) person.setPassword(new_password)
......
...@@ -27,7 +27,7 @@ if not portal.person_module.has_key('test_webmaster'): ...@@ -27,7 +27,7 @@ if not portal.person_module.has_key('test_webmaster'):
else: else:
person = portal.person_module.test_webmaster person = portal.person_module.test_webmaster
person.edit(first_name='Test', last_name='Webmaster', person.edit(first_name='Test', last_name='Webmaster',
reference='test_webmaster', password='test_webmaster') reference='test_webmaster')
person.setRole('internal') person.setRole('internal')
if not len(person.objectValues(portal_type='Assignment')): if not len(person.objectValues(portal_type='Assignment')):
assignment = person.newContent(portal_type='Assignment') assignment = person.newContent(portal_type='Assignment')
...@@ -36,6 +36,13 @@ if not len(person.objectValues(portal_type='Assignment')): ...@@ -36,6 +36,13 @@ if not len(person.objectValues(portal_type='Assignment')):
stop_date=DateTime('2990/12/31')) stop_date=DateTime('2990/12/31'))
if assignment.getValidationState() != 'open': if assignment.getValidationState() != 'open':
assignment.open() assignment.open()
if not len(person.objectValues(portal_type='ERP5 Login')):
login = person.newContent(
portal_type='ERP5 Login',
reference='test_webmaster',
password='test_webmaster',
)
login.validate()
if person.getValidationState() != 'validated': if person.getValidationState() != 'validated':
person.validate() person.validate()
......
...@@ -55,8 +55,13 @@ class ShaSecurityMixin(object): ...@@ -55,8 +55,13 @@ class ShaSecurityMixin(object):
if person is None: if person is None:
person = self.portal.person_module.newContent(portal_type='Person') person = self.portal.person_module.newContent(portal_type='Person')
person.edit(first_name=reference, person.edit(first_name=reference,
reference=reference, reference=reference)
password=password) login = person.newContent(
portal_type='ERP5 Login',
reference=reference,
password=password,
)
login.validate()
self.tic() self.tic()
create = True create = True
......
This diff is collapsed.
...@@ -64,10 +64,15 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -64,10 +64,15 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
person = person_module.newContent(id='pers', portal_type='Person', person = person_module.newContent(id='pers', portal_type='Person',
reference=self.username, reference=self.username,
first_name=self.first_name, first_name=self.first_name,
password=self.password,
default_email_text=self.recipient_email_address) default_email_text=self.recipient_email_address)
assignment = person.newContent(portal_type='Assignment') assignment = person.newContent(portal_type='Assignment')
assignment.open() assignment.open()
login = person.newContent(
portal_type='ERP5 Login',
reference=self.username,
password=self.password,
)
login.validate()
self.tic() self.tic()
def loginAsUser(self, username): def loginAsUser(self, username):
......
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