Commit aeea02cf authored by Gabriel Monnerat's avatar Gabriel Monnerat

fix my mistake. The automatic approval can be enabled for all tests.

parent 9adaa958
...@@ -68,7 +68,6 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -68,7 +68,6 @@ class TestERP5Credential(ERP5TypeTestCase):
self.createCategories() self.createCategories()
self.enableAlarm() self.enableAlarm()
self.validateNotificationMessages() self.validateNotificationMessages()
self.setUpSystemPreference()
# add a dummy mailhost not to send real messages # add a dummy mailhost not to send real messages
if 'MailHost' in self.portal.objectIds(): if 'MailHost' in self.portal.objectIds():
self.portal.manage_delObjects(['MailHost']) self.portal.manage_delObjects(['MailHost'])
...@@ -90,21 +89,6 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -90,21 +89,6 @@ class TestERP5Credential(ERP5TypeTestCase):
if notification_message.getValidationState() == 'draft': if notification_message.getValidationState() == 'draft':
notification_message.validate() notification_message.validate()
def setUpSystemPreference(self):
portal_preferences = self.getPreferenceTool()
preference = getattr(portal_preferences, 'test_site_preference', None)
if preference is None:
preference = preference = portal_preferences.newContent(portal_type='System Preference',
title='Default Site Preference',
id='test_site_preference')
self.stepTic()
if preference.getPreferenceState() == 'disabled':
preference.enable()
preference.edit(preferred_credential_request_automatic_approval=True,
preferred_credential_recovery_automatic_approval=True,
preferred_organisation_credential_update_automatic_approval=True,
preferred_person_credential_update_automatic_approval=True)
@reindex @reindex
def createCategories(self): def createCategories(self):
"""Create the categories for our test. """ """Create the categories for our test. """
...@@ -758,13 +742,13 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -758,13 +742,13 @@ class TestERP5Credential(ERP5TypeTestCase):
credential_reference = "credential_reference" credential_reference = "credential_reference"
self._createCredentialRequest(reference=credential_reference) self._createCredentialRequest(reference=credential_reference)
sequence.edit(credential_reference=credential_reference) sequence.edit(credential_reference=credential_reference)
def stepCheckIfMailMessageWasPosted(self, sequence=None, def stepCheckIfMailMessageWasPosted(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
credential_reference = sequence["credential_reference"] credential_reference_str = sequence["credential_reference"]
portal_catalog = self.portal.portal_catalog portal_catalog = self.portal.portal_catalog
credential_request = portal_catalog.getResultValue(portal_type="Credential Request", credential_reference = portal_catalog.getResultValue(portal_type="Credential Request",
reference=credential_reference) reference=credential_reference_str)
mail_message = portal_catalog.getResultValue(portal_type="Mail Message", mail_message = portal_catalog.getResultValue(portal_type="Mail Message",
follow_up=credential_reference) follow_up=credential_reference)
self.assertEquals(mail_message.getSimulationState(), "started") self.assertEquals(mail_message.getSimulationState(), "started")
...@@ -773,14 +757,17 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -773,14 +757,17 @@ class TestERP5Credential(ERP5TypeTestCase):
def testMailMessagePosted(self): def testMailMessagePosted(self):
""" Test if the Mail Message was posted correctly """ """ Test if the Mail Message was posted correctly """
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = 'CreateCredentialRequestSample '\ sequence_string = 'stepSetCredentialRequestAutomaticApprovalPreferences '\
'CreateCredentialRequestSample '\
'CheckIfMailMessageWasPosted '\ 'CheckIfMailMessageWasPosted '\
'stepUnSetCredentialAutomaticApprovalPreferences'\
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_MailFromMailMessageEvent(self): def test_MailFromMailMessageEvent(self):
""" """ """ """
self.stepSetCredentialRequestAutomaticApprovalPreferences()
self._createCredentialRequest(first_name="Vifib", self._createCredentialRequest(first_name="Vifib",
last_name="Test", last_name="Test",
reference="vifibtest") reference="vifibtest")
...@@ -799,10 +786,12 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -799,10 +786,12 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertNotEquals(re.search("Subject\:.*Welcome", message_text), None) self.assertNotEquals(re.search("Subject\:.*Welcome", message_text), None)
self.assertNotEquals(re.search("Hello\ Vifib\ Test\,", message_text), None) self.assertNotEquals(re.search("Hello\ Vifib\ Test\,", message_text), None)
self.assertNotEquals(re.search("key\=..%s" % mail_message.getReference(), message_text), None) self.assertNotEquals(re.search("key\=..%s" % mail_message.getReference(), message_text), None)
self.stepUnSetCredentialAutomaticApprovalPreferences()
def testERP5Site_activeLogin(self): def testERP5Site_activeLogin(self):
""" Test if the script WebSection_activeLogin will create one user """ Test if the script WebSection_activeLogin will create one user
correctly """ correctly """
self.stepSetCredentialRequestAutomaticApprovalPreferences()
self._createCredentialRequest() self._createCredentialRequest()
portal_catalog = self.portal.portal_catalog portal_catalog = self.portal.portal_catalog
credential_request = portal_catalog.getResultValue(portal_type="Credential Request", credential_request = portal_catalog.getResultValue(portal_type="Credential Request",
...@@ -815,16 +804,19 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -815,16 +804,19 @@ class TestERP5Credential(ERP5TypeTestCase):
self.stepTic() self.stepTic()
person = portal_catalog.getResultValue(reference="gabriel", portal_type="Person") person = portal_catalog.getResultValue(reference="gabriel", portal_type="Person")
self.assertEquals(person.getValidationState(), "validated") self.assertEquals(person.getValidationState(), "validated")
self.stepUnSetCredentialAutomaticApprovalPreferences()
def testERP5Site_registerCredentialRequest(self): def testERP5Site_registerCredentialRequest(self):
""" Test if the script ERP5Site_registerCredentialRequest will create one """ Test if the script ERP5Site_registerCredentialRequest will create one
Credential Request correctly """ Credential Request correctly """
self.stepSetCredentialRequestAutomaticApprovalPreferences()
self._createCredentialRequest() self._createCredentialRequest()
portal_catalog = self.portal.portal_catalog portal_catalog = self.portal.portal_catalog
credential_request = portal_catalog.getResultValue(portal_type="Credential Request", credential_request = portal_catalog.getResultValue(portal_type="Credential Request",
reference="gabriel") reference="gabriel")
self.assertEquals(credential_request.getFirstName(), "Gabriel") self.assertEquals(credential_request.getFirstName(), "Gabriel")
self.assertEquals(credential_request.getDefaultEmailText(), "gabriel@test.com") self.assertEquals(credential_request.getDefaultEmailText(), "gabriel@test.com")
self.stepUnSetCredentialAutomaticApprovalPreferences()
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