Commit f76f3f90 authored by Gabriel Monnerat's avatar Gabriel Monnerat

improve tests to validate the modifications of f01d4dcb

parent ab887735
...@@ -235,14 +235,23 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -235,14 +235,23 @@ class TestERP5Credential(ERP5TypeTestCase):
self.tic() self.tic()
self.logout() self.logout()
def stepSetCredentialRequestAutomaticApprovalPreferences(self, sequence=None, def stepSetCredentialRequestAutomaticApprovalPreferences(self, sequence=None):
sequence_list=None, **kw):
self.login() self.login()
preference = self._getPreference() preference = self._getPreference()
preference.edit(preferred_credential_request_automatic_approval=True) preference.edit(preferred_credential_request_automatic_approval=True)
self._enablePreference() self._enablePreference()
transaction.commit() self.stepTic()
self.tic() self.logout()
def stepSetCredentialAssignmentPropertyList(self, sequence={}):
role_list = sequence.get("role_list", ["internal",])
function_list = sequence.get("function_list", ["member",])
self.login()
preference = self._getPreference()
preference.edit(preferred_credential_assignment_role_list=role_list,
preferred_credential_assignment_function_list=function_list)
self._enablePreference()
self.stepTic()
self.logout() self.logout()
def stepSetOrganisationCredentialUpdateAutomaticApprovalPreferences(self, sequence=None, def stepSetOrganisationCredentialUpdateAutomaticApprovalPreferences(self, sequence=None,
...@@ -720,8 +729,7 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -720,8 +729,7 @@ class TestERP5Credential(ERP5TypeTestCase):
last_name="Monnerat", last_name="Monnerat",
reference="gabriel", reference="gabriel",
password="123", password="123",
default_email_text="gabriel@test.com", default_email_text="gabriel@test.com"):
role="client"):
self.logout() self.logout()
self.portal.ERP5Site_registerCredentialRequest(first_name=first_name, self.portal.ERP5Site_registerCredentialRequest(first_name=first_name,
last_name=last_name, last_name=last_name,
...@@ -732,8 +740,7 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -732,8 +740,7 @@ class TestERP5Credential(ERP5TypeTestCase):
default_telephone_text="223344", default_telephone_text="223344",
default_address_street_address="Test Street", default_address_street_address="Test Street",
default_address_city="Campos", default_address_city="Campos",
default_address_zip_code="28024030", default_address_zip_code="28024030")
role=role)
self.login("ERP5TypeTestCase") self.login("ERP5TypeTestCase")
self.stepTic() self.stepTic()
...@@ -823,29 +830,46 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -823,29 +830,46 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEquals(credential_request.getDefaultEmailText(), "gabriel@test.com") self.assertEquals(credential_request.getDefaultEmailText(), "gabriel@test.com")
self.stepUnSetCredentialAutomaticApprovalPreferences() self.stepUnSetCredentialAutomaticApprovalPreferences()
def testOverwriteBase_getDefaultAssignmentArgumentDict(self): def testBase_getDefaultAssignmentArgumentDict(self):
portal_catalog = self.portal.portal_catalog portal_catalog = self.portal.portal_catalog
portal_skins = self.getSkinsTool()
script = portal_skins.erp5_credential.Base_getDefaultAssignmentArgumentDict
self.login("ERP5TypeTestCase")
script.ZPythonScript_edit("**kw",
"return dict(role_list=['internal',], function_list=['member',])")
self.logout()
self.stepSetCredentialRequestAutomaticApprovalPreferences() self.stepSetCredentialRequestAutomaticApprovalPreferences()
self._createCredentialRequest(role=None) self.stepSetCredentialAssignmentPropertyList()
self._createCredentialRequest()
credential_request = portal_catalog.getResultValue(portal_type="Credential Request", credential_request = portal_catalog.getResultValue(portal_type="Credential Request",
reference="gabriel") reference="gabriel")
mail_message = portal_catalog.getResultValue(portal_type="Mail Message", mail_message = portal_catalog.getResultValue(portal_type="Mail Message",
follow_up=credential_request) follow_up=credential_request)
self.stepTic()
self.logout() self.logout()
self.portal.ERP5Site_activeLogin(mail_message.getReference()) self.portal.ERP5Site_activeLogin(mail_message.getReference())
self.login("ERP5TypeTestCase") self.login("ERP5TypeTestCase")
self.stepTic() self.stepTic()
person = portal_catalog.getResultValue(reference="gabriel", portal_type="Person") person = portal_catalog.getResultValue(reference="gabriel", portal_type="Person")
assignment_list = person.objectValues(portal_type="Assignment") assignment_list = person.objectValues(portal_type="Assignment")
self.assertEquals(len(assignment_list), 1)
assignment = assignment_list[0] assignment = assignment_list[0]
self.assertEquals(assignment.getFunction(), "member") self.assertEquals(assignment.getFunction(), "member")
self.assertEquals(assignment.getRole(), "internal") self.assertEquals(assignment.getRole(), "internal")
self.stepSetCredentialAssignmentPropertyList(dict(role_list=["client",],
function_list=["agent"]))
self._createCredentialRequest(reference="credential_user")
credential_request = portal_catalog.getResultValue(portal_type="Credential Request",
reference="credential_user")
mail_message = portal_catalog.getResultValue(portal_type="Mail Message",
follow_up=credential_request)
self.stepTic()
self.logout()
self.portal.ERP5Site_activeLogin(mail_message.getReference())
self.login("ERP5TypeTestCase")
self.stepTic()
person = portal_catalog.getResultValue(reference="credential_user",
portal_type="Person")
assignment_list = person.objectValues(portal_type="Assignment")
self.assertEquals(len(assignment_list), 1)
assignment = assignment_list[0]
self.assertEquals(assignment.getFunction(), "agent")
self.assertEquals(assignment.getRole(), "client")
def test_xx_checkCredentialQuestionIsNotCaseSensitive(self): def test_xx_checkCredentialQuestionIsNotCaseSensitive(self):
''' '''
......
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