Commit dc2cd9ec authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor test to validate ung configuration with language fr and pt-BR

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45028 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dc8a0a0b
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
""" """
Test Live UNG Configuration Workflow. Test UNG Configuration Workflow Mixin.
""" """
standard_bt5_list = ('erp5_ingestion_mysql_innodb_catalog', standard_bt5_list = ('erp5_ingestion_mysql_innodb_catalog',
...@@ -79,12 +79,12 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -79,12 +79,12 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
stepConfiguratorNext stepConfiguratorNext
stepTic stepTic
stepCheckConfigureMultipleUserAccountForm stepCheckConfigureMultipleUserAccountForm
stepSetupMultipleUserAccountThree stepSetupMultipleUserAccountThree%(country)s
stepConfiguratorNext stepConfiguratorNext
stepTic stepTic
stepCheckConfigurePreferenceForm stepCheckConfigurePreferenceForm
stepCheckMultipleUserAccountThree stepCheckMultipleUserAccountThree%(country)s
stepSetupPreferenceConfigurationBrazil stepSetupPreferenceConfiguration%(country)s
stepConfiguratorNext stepConfiguratorNext
stepTic stepTic
stepCheckConfigureWebSiteForm stepCheckConfigureWebSiteForm
...@@ -215,7 +215,15 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -215,7 +215,15 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals('Configure user accounts', response_dict['next']) self.assertEquals('Configure user accounts', response_dict['next'])
self.assertCurrentStep('Configuration of users', response_dict) self.assertCurrentStep('Configuration of users', response_dict)
def stepSetupMultipleUserAccountThree(self, sequence=None, sequence_list=None, **kw): def _stepSetupMultipleUserAccountThree(self, sequence, user_list):
""" Generic step to create multiple user account """
next_dict = {}
for user in user_list:
for k, v in user.items():
next_dict.setdefault(k, []).append(v)
sequence.edit(next_dict=next_dict)
def stepSetupMultipleUserAccountThreeBrazil(self, sequence=None, sequence_list=None, **kw):
""" Create multiple user account """ """ Create multiple user account """
user_list = [ user_list = [
dict( dict(
...@@ -244,20 +252,38 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -244,20 +252,38 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
field_your_default_telephone_text='', field_your_default_telephone_text='',
), ),
] ]
next_dict = {} self._stepSetupMultipleUserAccountThree(sequence, user_list)
for user in user_list:
for k, v in user.items():
next_dict.setdefault(k, []).append(v)
sequence.edit(next_dict=next_dict)
def stepCheckConfigurePreferenceForm(self, sequence=None, sequence_list=None, **kw): def stepSetupMultipleUserAccountThreeFrance(self, sequence=None, sequence_list=None, **kw):
""" Check the multiple user account form """ """ Create multiple user account """
response_dict = sequence.get("response_dict") user_list = [
if 'command' in response_dict: dict(
self.assertEquals('show', response_dict['command']) field_your_first_name='Person',
self.assertEquals('Previous', response_dict['previous']) field_your_last_name='Creator',
self.assertEquals('Configure user accounts', response_dict['next']) field_your_reference="french_creator",
self.assertCurrentStep('Configuration of users', response_dict) field_your_password='person_creator',
field_your_password_confirm='person_creator',
field_your_default_email_text='test@test.com',
field_your_default_telephone_text='',
), dict(
field_your_first_name='Person',
field_your_last_name='Assignee',
field_your_reference="french_assignee",
field_your_password='person_assignee',
field_your_password_confirm='person_assignee',
field_your_default_email_text='test@test.com',
field_your_default_telephone_text='',
), dict(
field_your_first_name='Person',
field_your_last_name='Assignor',
field_your_reference="french_assignor",
field_your_password='person_assignor',
field_your_password_confirm='person_assignor',
field_your_default_email_text='test@test.com',
field_your_default_telephone_text='',
),
]
self._stepSetupMultipleUserAccountThree(sequence, user_list)
def stepCheckConfigurePreferenceForm(self, sequence=None, sequence_list=None, **kw): def stepCheckConfigurePreferenceForm(self, sequence=None, sequence_list=None, **kw):
""" Check the multiple user account form """ """ Check the multiple user account form """
...@@ -271,11 +297,20 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -271,11 +297,20 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
def stepSetupPreferenceConfigurationBrazil(self, sequence=None, sequence_list=None, **kw): def stepSetupPreferenceConfigurationBrazil(self, sequence=None, sequence_list=None, **kw):
""" Setup the Brazil preference configuration """ """ Setup the Brazil preference configuration """
next_dict = dict(field_your_preferred_date_order='dmy', next_dict = dict(field_your_preferred_date_order='dmy',
field_your_lang='erp5_l10n_fr',
field_your_preferred_event_sender_email="test@test.com",
default_field_your_lang=1)
sequence.edit(next_dict=next_dict)
def stepSetupPreferenceConfigurationFrance(self, sequence=None, sequence_list=None, **kw):
""" Setup the Brazil preference configuration """
next_dict = dict(field_your_preferred_date_order='ymd',
field_your_lang='erp5_l10n_pt-BR', field_your_lang='erp5_l10n_pt-BR',
field_your_preferred_event_sender_email="test@test.com", field_your_preferred_event_sender_email="test@test.com",
default_field_your_lang=1) default_field_your_lang=1)
sequence.edit(next_dict=next_dict) sequence.edit(next_dict=next_dict)
def stepCheckConfigureWebSiteForm(self, sequence=None, sequence_list=None, **kw): def stepCheckConfigureWebSiteForm(self, sequence=None, sequence_list=None, **kw):
""" Check the installation form """ """ Check the installation form """
response_dict = sequence.get("response_dict") response_dict = sequence.get("response_dict")
...@@ -284,7 +319,7 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -284,7 +319,7 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals('Previous', response_dict['previous']) self.assertEquals('Previous', response_dict['previous'])
self.assertEquals('Configure Web Site', response_dict['next']) self.assertEquals('Configure Web Site', response_dict['next'])
def stepCheckMultipleUserAccountThree(self, sequence=None, sequence_list=None, **kw): def stepCheckMultipleUserAccountThreeBrazil(self, sequence=None, sequence_list=None, **kw):
""" Check if the users were created correctly """ """ Check if the users were created correctly """
business_configuration = sequence.get("business_configuration") business_configuration = sequence.get("business_configuration")
person_config_save = business_configuration["5"] person_config_save = business_configuration["5"]
...@@ -295,10 +330,16 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -295,10 +330,16 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
person_config_item = person_config_save["3"] person_config_item = person_config_save["3"]
self.assertEquals(person_config_item.getReference(), "person_assignor") self.assertEquals(person_config_item.getReference(), "person_assignor")
def stepSetupWebSiteConfiguration(self, sequence=None, sequence_list=None, **kw): def stepCheckMultipleUserAccountThreeFrance(self, sequence=None, sequence_list=None, **kw):
""" Setup Web Site """ """ Check if the users were created correctly """
next_dict = dict(your_default_available_language="pt-BR") business_configuration = sequence.get("business_configuration")
sequence.edit(next_dict=next_dict) person_config_save = business_configuration["5"]
person_config_item = person_config_save["1"]
self.assertEquals(person_config_item.getReference(), "french_creator")
person_config_item = person_config_save["2"]
self.assertEquals(person_config_item.getReference(), "french_assignee")
person_config_item = person_config_save["3"]
self.assertEquals(person_config_item.getReference(), "french_assignor")
def stepCheckConfigureInstallationForm(self, sequence=None, sequence_list=None, **kw): def stepCheckConfigureInstallationForm(self, sequence=None, sequence_list=None, **kw):
""" Check the installation form """ """ Check the installation form """
...@@ -322,6 +363,24 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -322,6 +363,24 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.portal.portal_configurator.startInstallation( self.portal.portal_configurator.startInstallation(
business_configuration, REQUEST=self.portal.REQUEST) business_configuration, REQUEST=self.portal.REQUEST)
class TestUNGConfiguratorWorkflowFranceLanguage(TestUNGConfiguratorWorkflowMixin):
"""
Test UNG Configuration Workflow
"""
def test_ung_workflow_france(self):
""" Test the ung workflow with french language """
sequence_list = SequenceList()
sequence_string = self.DEFAULT_SEQUENCE_LIST % dict(country='France')
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepSetupWebSiteConfiguration(self, sequence=None, sequence_list=None, **kw):
""" Setup Web Site """
next_dict = dict(your_default_available_language="fr")
sequence.edit(next_dict=next_dict)
def stepCheckUNGWebSiteAfterInstallation(self, sequence=None, sequence_list=None, **kw): def stepCheckUNGWebSiteAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check if UNG Web Site is published and your language""" """ Check if UNG Web Site is published and your language"""
ung_web_site = self.portal.web_site_module.ung ung_web_site = self.portal.web_site_module.ung
...@@ -329,9 +388,9 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -329,9 +388,9 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals(ung_web_site.getValidationState(), self.assertEquals(ung_web_site.getValidationState(),
"published") "published")
self.assertEquals(ung_web_site.getDefaultAvailableLanguage(), self.assertEquals(ung_web_site.getDefaultAvailableLanguage(),
"pt-BR") "fr")
person = portal_catalog.getResultValue(portal_type="Person", person = portal_catalog.getResultValue(portal_type="Person",
reference="person_creator") reference="french_creator")
self.assertEquals(person.getValidationState(), 'validated') self.assertEquals(person.getValidationState(), 'validated')
self.assertEquals(person.getFirstName(), 'Person') self.assertEquals(person.getFirstName(), 'Person')
self.assertEquals(person.getLastName(), 'Creator') self.assertEquals(person.getLastName(), 'Creator')
...@@ -339,7 +398,7 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -339,7 +398,7 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals(assignment.getValidationState(), "open") self.assertEquals(assignment.getValidationState(), "open")
self.assertEquals(assignment.getFunction(), "function/ung_user") self.assertEquals(assignment.getFunction(), "function/ung_user")
person = portal_catalog.getResultValue(portal_type="Person", person = portal_catalog.getResultValue(portal_type="Person",
reference="person_assignee") reference="french_assignee")
self.assertEquals(person.getValidationState(), 'validated') self.assertEquals(person.getValidationState(), 'validated')
self.assertEquals(person.getFirstName(), 'Person') self.assertEquals(person.getFirstName(), 'Person')
self.assertEquals(person.getLastName(), 'Assignee') self.assertEquals(person.getLastName(), 'Assignee')
...@@ -347,7 +406,7 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -347,7 +406,7 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals(assignment.getValidationState(), "open") self.assertEquals(assignment.getValidationState(), "open")
self.assertEquals(assignment.getFunction(), "function/ung_user") self.assertEquals(assignment.getFunction(), "function/ung_user")
person = portal_catalog.getResultValue(portal_type="Person", person = portal_catalog.getResultValue(portal_type="Person",
reference="person_assignor") reference="french_assignor")
self.assertEquals(person.getValidationState(), 'validated') self.assertEquals(person.getValidationState(), 'validated')
self.assertEquals(person.getFirstName(), 'Person') self.assertEquals(person.getFirstName(), 'Person')
self.assertEquals(person.getLastName(), 'Assignor') self.assertEquals(person.getLastName(), 'Assignor')
...@@ -358,8 +417,55 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase): ...@@ -358,8 +417,55 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(), 8011) self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(), 8011)
self.assertEquals(system_preference.getPreferredOoodocServerAddress(), "localhost") self.assertEquals(system_preference.getPreferredOoodocServerAddress(), "localhost")
class TestUNGConfiguratorWorkflowBrazilLanguage(TestUNGConfiguratorWorkflowMixin):
"""
Test UNG Configuration Workflow
"""
def test_ung_workflow_brazil(self): def test_ung_workflow_brazil(self):
""" Test the ung workflow with brazilian language """ """ Test the ung workflow with brazilian language """
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_list.addSequenceString(self.DEFAULT_SEQUENCE_LIST) sequence_string = self.DEFAULT_SEQUENCE_LIST % dict(country='Brazil')
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def stepSetupWebSiteConfiguration(self, sequence=None, sequence_list=None, **kw):
""" Setup Web Site """
next_dict = dict(your_default_available_language="pt-BR")
sequence.edit(next_dict=next_dict)
def stepCheckUNGWebSiteAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check if UNG Web Site is published and your language"""
ung_web_site = self.portal.web_site_module.ung
portal_catalog = self.portal.portal_catalog
self.assertEquals(ung_web_site.getValidationState(),
"published")
self.assertEquals(ung_web_site.getDefaultAvailableLanguage(),
"pt-BR")
person = portal_catalog.getResultValue(portal_type="Person",
reference="person_creator")
self.assertEquals(person.getValidationState(), 'validated')
self.assertEquals(person.getFirstName(), 'Person')
self.assertEquals(person.getLastName(), 'Creator')
assignment = person.contentValues(portal_type="Assignment")[0]
self.assertEquals(assignment.getValidationState(), "open")
self.assertEquals(assignment.getFunction(), "function/ung_user")
person = portal_catalog.getResultValue(portal_type="Person",
reference="person_assignee")
self.assertEquals(person.getValidationState(), 'validated')
self.assertEquals(person.getFirstName(), 'Person')
self.assertEquals(person.getLastName(), 'Assignee')
assignment = person.contentValues(portal_type="Assignment")[0]
self.assertEquals(assignment.getValidationState(), "open")
self.assertEquals(assignment.getFunction(), "function/ung_user")
person = portal_catalog.getResultValue(portal_type="Person",
reference="person_assignor")
self.assertEquals(person.getValidationState(), 'validated')
self.assertEquals(person.getFirstName(), 'Person')
self.assertEquals(person.getLastName(), 'Assignor')
assignment = person.contentValues(portal_type="Assignment")[0]
self.assertEquals(assignment.getValidationState(), "open")
self.assertEquals(assignment.getFunction(), "function/ung_user")
system_preference = portal_catalog.getResultValue(portal_type="System Preference")
self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(), 8011)
self.assertEquals(system_preference.getPreferredOoodocServerAddress(), "localhost")
\ No newline at end of file
29 30
\ No newline at end of file \ No newline at end of file
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