[Erp5-report] r38973 fabien - in /experimental/bt5/erp5_credential: TestTemplateItem/ bt/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Oct 7 16:19:43 CEST 2010
Author: fabien
Date: Thu Oct 7 16:19:42 2010
New Revision: 38973
URL: http://svn.erp5.org?rev=38973&view=rev
Log:
update test because of the last changes :
- enable the alarm
- validate notification messages
- fix some mistakes
- remove stepCheckCredentialUpdateForm as there is no dialog in the
generic erp5_credential
Modified:
experimental/bt5/erp5_credential/TestTemplateItem/testERP5Credential.py
experimental/bt5/erp5_credential/bt/revision
Modified: experimental/bt5/erp5_credential/TestTemplateItem/testERP5Credential.py
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/TestTemplateItem/testERP5Credential.py?rev=38973&r1=38972&r2=38973&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/TestTemplateItem/testERP5Credential.py [utf8] (original)
+++ experimental/bt5/erp5_credential/TestTemplateItem/testERP5Credential.py [utf8] Thu Oct 7 16:19:42 2010
@@ -60,12 +60,30 @@ class TestERP5Credential(ERP5TypeTestCas
def afterSetUp(self):
"""Prepare the test."""
self.createCategories()
+ self.enableAlarm()
+ self.validateNotificationMessages()
# add a dummy mailhost not to send real messages
if 'MailHost' in self.portal.objectIds():
self.portal.manage_delObjects(['MailHost'])
self.portal._setObject('MailHost', DummyMailHost('MailHost'))
@reindex
+ def enableAlarm(self):
+ """activate the alarm"""
+ portal = self.getPortalObject()
+ alarm = portal.portal_alarms.accept_submitted_credentials
+ if not alarm.isEnabled():
+ alarm.setEnabled(True)
+
+ def validateNotificationMessages(self):
+ '''validate all notification messages'''
+ portal = self.getPortalObject()
+ notification_message_module = portal.getDefaultModule('Notification Message')
+ for notification_message in notification_message_module.contentValues():
+ if notification_message.getValidationState() == 'draft':
+ notification_message.validate()
+
+ @reindex
def createCategories(self):
"""Create the categories for our test. """
# create categories
@@ -245,7 +263,7 @@ class TestERP5Credential(ERP5TypeTestCas
sequence_list=None, **kw):
self.login()
preference = self._getPreference()
- preference.edit(preferred_person_credential_update_automatic_approval=False)
+ preference.edit(preferred_person_credential_update_automatic_approval=True)
self._enablePreference()
transaction.commit()
self.tic()
@@ -301,12 +319,14 @@ class TestERP5Credential(ERP5TypeTestCas
# check annonymous can access subscription form
self.assertTrue("Desired Login Name" in request.traverse(form_url)())
# fill in and submit the subscription form
+
result = self.portal.ERP5Site_newCredentialRequest(\
first_name='Homer',
last_name='Simpson',
reference='homie',
password='secret',
- default_email_text='homer.simpson at fox.com'
+ default_email_text='homer.simpson at fox.com',
+ role_list=['internal'],
)
self.assertTrue('portal_status_message=A%20new%20credential%20request%20'\
'has%20been%20created.' in result)
@@ -320,8 +340,10 @@ class TestERP5Credential(ERP5TypeTestCas
def stepAcceptSubscriptionRequest(self, sequence=None, sequence_list=None,
**kw):
+ self.login()
subscription_request = sequence.get('subscription_request')
subscription_request.accept()
+ self.logout()
def stepCheckAccountIsCreated(self, sequence=None, sequence_list=None, **kw):
# check a person have been created
@@ -343,34 +365,26 @@ class TestERP5Credential(ERP5TypeTestCas
Create a credential update object an fill it with some modified
informations
'''
- self.login('homie')
- # fill in and submit the credential update form
- result = self.portal.ERP5Site_newCredentialUpdate(\
+ self.login()
+ # get the 'homie' person object
+ person_module = self.portal.getDefaultModule('Person')
+ result = person_module.searchFolder(reference='homie')
+ self.assertEquals(len(result), 1)
+ homie = result[0]
+
+ # create a credential update
+ credential_update_module = self.portal.getDefaultModule(\
+ 'Credential Update')
+ credential_update = credential_update_module.newContent(\
first_name='Homie',
last_name='Simpsons', # add a 's' to the end of the last_name
password='new_password',
- default_email_text='homie.simpsons at fox.com'
- )
- self.assertTrue('portal_status_message=A%20new%20credential%20request%20'\
- 'has%20been%20created.' in result)
- credential_request_module = self.portal.getDefaultModule('Credential Update')
- result = credential_request_module.contentValues(\
- portal_type='Credential Update', first_name='Homie',
- last_name='Simpsons')
- self.assertEquals(len(result), 1)
- credential_update = result[0]
- sequence.edit(credential_update=credential_update)
+ default_email_text='homie.simpsons at fox.com',
+ destination_decision=homie.getRelativeUrl())
- def stepCheckCredentialUpdateForm(self, sequence=None, sequence_list=None, **kw):
- '''check the dialog is automatically pre-filled with the values of logged in
- user
- '''
- self.login('homie')
- result = self.portal.ERP5Site_viewNewCredentialUpdateDialog()
- self.assertTrue('name="field_your_first_name" value="Homer"' in result)
- self.assertTrue('name="field_your_last_name" value="Simpson"' in result)
- self.assertTrue('name="field_your_default_email_text" '\
- 'value="homer.simpson at fox.com"' in result)
+ credential_update.submit()
+ self.assertEquals(credential_update.getValidationState(), 'submitted')
+ sequence.edit(credential_update=credential_update)
def stepAcceptCredentialUpdate(self, sequence=None, sequence_list=None,
**kw):
@@ -618,7 +632,6 @@ class TestERP5Credential(ERP5TypeTestCas
sequence_string = 'CreateSimpleSubscriptionRequest '\
'AcceptSubscriptionRequest Tic '\
'CreateCredentialUpdate '\
- 'CheckCredentialUpdateForm '\
'AcceptCredentialUpdate Tic '\
'CheckCredentialUpdate '\
@@ -651,6 +664,7 @@ class TestERP5Credential(ERP5TypeTestCas
sequence_string = 'SetPersonCredentialUpdateAutomaticApprovalPreferences '\
'CreateSimpleSubscriptionRequest '\
'AcceptSubscriptionRequest Tic '\
+ 'CheckAccountIsCreated '\
'CreateCredentialUpdate Tic '\
'CheckCredentialUpdate '\
Modified: experimental/bt5/erp5_credential/bt/revision
URL: http://svn.erp5.org/experimental/bt5/erp5_credential/bt/revision?rev=38973&r1=38972&r2=38973&view=diff
==============================================================================
--- experimental/bt5/erp5_credential/bt/revision [utf8] (original)
+++ experimental/bt5/erp5_credential/bt/revision [utf8] Thu Oct 7 16:19:42 2010
@@ -1 +1 @@
-296
\ No newline at end of file
+297
\ No newline at end of file
More information about the Erp5-report
mailing list