From aeea02cfe707a05a5228bf7c1398769924d712d2 Mon Sep 17 00:00:00 2001 From: Gabriel Monnerat <gabriel@tiolive.com> Date: Tue, 7 Jun 2011 17:25:50 -0300 Subject: [PATCH] fix my mistake. The automatic approval can be enabled for all tests. --- product/ERP5/tests/testERP5Credential.py | 36 +++++++++--------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/product/ERP5/tests/testERP5Credential.py b/product/ERP5/tests/testERP5Credential.py index 53bdbf442b..ef92c7d3db 100644 --- a/product/ERP5/tests/testERP5Credential.py +++ b/product/ERP5/tests/testERP5Credential.py @@ -68,7 +68,6 @@ class TestERP5Credential(ERP5TypeTestCase): self.createCategories() self.enableAlarm() self.validateNotificationMessages() - self.setUpSystemPreference() # add a dummy mailhost not to send real messages if 'MailHost' in self.portal.objectIds(): self.portal.manage_delObjects(['MailHost']) @@ -90,21 +89,6 @@ class TestERP5Credential(ERP5TypeTestCase): if notification_message.getValidationState() == 'draft': 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 def createCategories(self): """Create the categories for our test. """ @@ -758,13 +742,13 @@ class TestERP5Credential(ERP5TypeTestCase): credential_reference = "credential_reference" self._createCredentialRequest(reference=credential_reference) sequence.edit(credential_reference=credential_reference) - + def stepCheckIfMailMessageWasPosted(self, sequence=None, sequence_list=None, **kw): - credential_reference = sequence["credential_reference"] + credential_reference_str = sequence["credential_reference"] portal_catalog = self.portal.portal_catalog - credential_request = portal_catalog.getResultValue(portal_type="Credential Request", - reference=credential_reference) + credential_reference = portal_catalog.getResultValue(portal_type="Credential Request", + reference=credential_reference_str) mail_message = portal_catalog.getResultValue(portal_type="Mail Message", follow_up=credential_reference) self.assertEquals(mail_message.getSimulationState(), "started") @@ -773,14 +757,17 @@ class TestERP5Credential(ERP5TypeTestCase): def testMailMessagePosted(self): """ Test if the Mail Message was posted correctly """ sequence_list = SequenceList() - sequence_string = 'CreateCredentialRequestSample '\ + sequence_string = 'stepSetCredentialRequestAutomaticApprovalPreferences '\ + 'CreateCredentialRequestSample '\ 'CheckIfMailMessageWasPosted '\ - + 'stepUnSetCredentialAutomaticApprovalPreferences'\ + sequence_list.addSequenceString(sequence_string) sequence_list.play(self) def test_MailFromMailMessageEvent(self): """ """ + self.stepSetCredentialRequestAutomaticApprovalPreferences() self._createCredentialRequest(first_name="Vifib", last_name="Test", reference="vifibtest") @@ -799,10 +786,12 @@ class TestERP5Credential(ERP5TypeTestCase): self.assertNotEquals(re.search("Subject\:.*Welcome", 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.stepUnSetCredentialAutomaticApprovalPreferences() def testERP5Site_activeLogin(self): """ Test if the script WebSection_activeLogin will create one user correctly """ + self.stepSetCredentialRequestAutomaticApprovalPreferences() self._createCredentialRequest() portal_catalog = self.portal.portal_catalog credential_request = portal_catalog.getResultValue(portal_type="Credential Request", @@ -815,16 +804,19 @@ class TestERP5Credential(ERP5TypeTestCase): self.stepTic() person = portal_catalog.getResultValue(reference="gabriel", portal_type="Person") self.assertEquals(person.getValidationState(), "validated") + self.stepUnSetCredentialAutomaticApprovalPreferences() def testERP5Site_registerCredentialRequest(self): """ Test if the script ERP5Site_registerCredentialRequest will create one Credential Request correctly """ + self.stepSetCredentialRequestAutomaticApprovalPreferences() self._createCredentialRequest() portal_catalog = self.portal.portal_catalog credential_request = portal_catalog.getResultValue(portal_type="Credential Request", reference="gabriel") self.assertEquals(credential_request.getFirstName(), "Gabriel") self.assertEquals(credential_request.getDefaultEmailText(), "gabriel@test.com") + self.stepUnSetCredentialAutomaticApprovalPreferences() def test_xx_checkCredentialQuestionIsNotCaseSensitive(self): ''' -- 2.30.9