Commit 6996139b authored by Gabriel Monnerat's avatar Gabriel Monnerat

add step to create a Person to avoid duplicated code and add test to check...

add step to create a Person to avoid duplicated code and add test to check that to prove that ERP5Site_newCredentialRecovery will work correctly in case if no question/answer is provided
parent 601e0fed
...@@ -528,11 +528,11 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -528,11 +528,11 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEquals(related_person.getDefaultCredentialQuestionAnswer(), self.assertEquals(related_person.getDefaultCredentialQuestionAnswer(),
'Renault 4L') 'Renault 4L')
def stepCreateCredentialRecovery(self, sequence=None, sequence_list=None, def stepCreatePerson(self, sequence=None, sequence_list=None,
**kw): **kw):
''' """
Create a simple subscription request Create a simple person
''' """
portal = self.getPortalObject() portal = self.getPortalObject()
# create a person with 'secret' as password # create a person with 'secret' as password
self.login() self.login()
...@@ -545,9 +545,18 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -545,9 +545,18 @@ class TestERP5Credential(ERP5TypeTestCase):
assignment = barney.newContent(portal_type='Assignment', assignment = barney.newContent(portal_type='Assignment',
function='member') function='member')
assignment.open() assignment.open()
transaction.commit() sequence.edit(person_reference=barney.getReference())
self.tic()
sequence.edit(barney=barney) def stepCreateCredentialRecovery(self, sequence=None, sequence_list=None,
**kw):
'''
Create a simple subscription request
'''
portal = self.getPortalObject()
person_reference = sequence["person_reference"]
person = portal.portal_catalog.getResultValue(portal_type="Person",
reference=person_reference)
sequence.edit(barney=person)
# check barney can log in the system # check barney can log in the system
self._assertUserExists('barney', 'secret') self._assertUserExists('barney', 'secret')
self.login('barney') self.login('barney')
...@@ -561,9 +570,25 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -561,9 +570,25 @@ class TestERP5Credential(ERP5TypeTestCase):
'Credential Recovery') 'Credential Recovery')
# associate it with barney # associate it with barney
credential_recovery.setDestinationDecisionValue(barney) credential_recovery.setDestinationDecisionValue(person)
sequence.edit(credential_recovery=credential_recovery) sequence.edit(credential_recovery=credential_recovery)
def stepRequestCredentialRecoveryWithERP5Site_newCredentialRecovery(self,
sequence=None, sequence_list=None, **kw):
person_reference = sequence["person_reference"]
self.portal.ERP5Site_newCredentialRecovery(reference=person_reference)
def stepCheckCredentialRecoveryCreation(self, sequence=None,
sequence_list=None, **kw):
person_reference = sequence["person_reference"]
result_list = self.portal.portal_catalog(
portal_type='Credential Recovery', reference=person_reference)
self.assertEquals(1, len(result_list))
credential_recovery = result_list[0]
person = credential_recovery.getDestinationDecisionValue()
self.assertEquals("Barney", person.getTitle())
self.assertEquals("barney@duff.com", person.getEmailText())
def stepSubmitCredentialRecovery(self, sequence=None, sequence_list=None, def stepSubmitCredentialRecovery(self, sequence=None, sequence_list=None,
**kw): **kw):
credential_recovery = sequence.get('credential_recovery') credential_recovery = sequence.get('credential_recovery')
...@@ -738,7 +763,8 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -738,7 +763,8 @@ class TestERP5Credential(ERP5TypeTestCase):
log in the system with this new password log in the system with this new password
''' '''
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = 'CreateCredentialRecovery Tic '\ sequence_string = 'CreatePerson Tic '\
'CreateCredentialRecovery Tic '\
'SubmitCredentialRecovery Tic '\ 'SubmitCredentialRecovery Tic '\
'AcceptCredentialRecovery Tic '\ 'AcceptCredentialRecovery Tic '\
'CheckEmailIsSent Tic '\ 'CheckEmailIsSent Tic '\
...@@ -885,6 +911,18 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -885,6 +911,18 @@ class TestERP5Credential(ERP5TypeTestCase):
assignment_role="client") assignment_role="client")
self.stepCheckAssignmentAfterActiveLogin(sequence) self.stepCheckAssignmentAfterActiveLogin(sequence)
def testERP5Site_newCredentialRecoveryWithNoSecurityQuestion(self):
"""
Check that password recovery works in case if not security question with
answer is defined
"""
sequence_list = SequenceList()
sequence_string = "CreatePerson Tic " \
"RequestCredentialRecoveryWithERP5Site_newCredentialRecovery Tic " \
"CheckCredentialRecoveryCreation"
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_xx_checkCredentialQuestionIsNotCaseSensitive(self): def test_xx_checkCredentialQuestionIsNotCaseSensitive(self):
''' '''
check that if the user enter an answer with a diffent case, this will still check that if the user enter an answer with a diffent case, this will still
......
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