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 @@
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
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',
......@@ -79,12 +79,12 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
stepConfiguratorNext
stepTic
stepCheckConfigureMultipleUserAccountForm
stepSetupMultipleUserAccountThree
stepSetupMultipleUserAccountThree%(country)s
stepConfiguratorNext
stepTic
stepCheckConfigurePreferenceForm
stepCheckMultipleUserAccountThree
stepSetupPreferenceConfigurationBrazil
stepCheckMultipleUserAccountThree%(country)s
stepSetupPreferenceConfiguration%(country)s
stepConfiguratorNext
stepTic
stepCheckConfigureWebSiteForm
......@@ -215,7 +215,15 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals('Configure user accounts', response_dict['next'])
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 """
user_list = [
dict(
......@@ -244,20 +252,38 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
field_your_default_telephone_text='',
),
]
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)
self._stepSetupMultipleUserAccountThree(sequence, user_list)
def stepCheckConfigurePreferenceForm(self, sequence=None, sequence_list=None, **kw):
""" Check the multiple user account form """
response_dict = sequence.get("response_dict")
if 'command' in response_dict:
self.assertEquals('show', response_dict['command'])
self.assertEquals('Previous', response_dict['previous'])
self.assertEquals('Configure user accounts', response_dict['next'])
self.assertCurrentStep('Configuration of users', response_dict)
def stepSetupMultipleUserAccountThreeFrance(self, sequence=None, sequence_list=None, **kw):
""" Create multiple user account """
user_list = [
dict(
field_your_first_name='Person',
field_your_last_name='Creator',
field_your_reference="french_creator",
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):
""" Check the multiple user account form """
......@@ -271,11 +297,20 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
def stepSetupPreferenceConfigurationBrazil(self, sequence=None, sequence_list=None, **kw):
""" Setup the Brazil preference configuration """
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_preferred_event_sender_email="test@test.com",
default_field_your_lang=1)
sequence.edit(next_dict=next_dict)
def stepCheckConfigureWebSiteForm(self, sequence=None, sequence_list=None, **kw):
""" Check the installation form """
response_dict = sequence.get("response_dict")
......@@ -284,7 +319,7 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals('Previous', response_dict['previous'])
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 """
business_configuration = sequence.get("business_configuration")
person_config_save = business_configuration["5"]
......@@ -295,10 +330,16 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
person_config_item = person_config_save["3"]
self.assertEquals(person_config_item.getReference(), "person_assignor")
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 stepCheckMultipleUserAccountThreeFrance(self, sequence=None, sequence_list=None, **kw):
""" Check if the users were created correctly """
business_configuration = sequence.get("business_configuration")
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):
""" Check the installation form """
......@@ -322,6 +363,24 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.portal.portal_configurator.startInstallation(
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):
""" Check if UNG Web Site is published and your language"""
ung_web_site = self.portal.web_site_module.ung
......@@ -329,9 +388,9 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals(ung_web_site.getValidationState(),
"published")
self.assertEquals(ung_web_site.getDefaultAvailableLanguage(),
"pt-BR")
"fr")
person = portal_catalog.getResultValue(portal_type="Person",
reference="person_creator")
reference="french_creator")
self.assertEquals(person.getValidationState(), 'validated')
self.assertEquals(person.getFirstName(), 'Person')
self.assertEquals(person.getLastName(), 'Creator')
......@@ -339,7 +398,7 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals(assignment.getValidationState(), "open")
self.assertEquals(assignment.getFunction(), "function/ung_user")
person = portal_catalog.getResultValue(portal_type="Person",
reference="person_assignee")
reference="french_assignee")
self.assertEquals(person.getValidationState(), 'validated')
self.assertEquals(person.getFirstName(), 'Person')
self.assertEquals(person.getLastName(), 'Assignee')
......@@ -347,7 +406,7 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals(assignment.getValidationState(), "open")
self.assertEquals(assignment.getFunction(), "function/ung_user")
person = portal_catalog.getResultValue(portal_type="Person",
reference="person_assignor")
reference="french_assignor")
self.assertEquals(person.getValidationState(), 'validated')
self.assertEquals(person.getFirstName(), 'Person')
self.assertEquals(person.getLastName(), 'Assignor')
......@@ -358,8 +417,55 @@ class TestUNGConfiguratorWorkflow(ERP5TypeTestCase):
self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(), 8011)
self.assertEquals(system_preference.getPreferredOoodocServerAddress(), "localhost")
class TestUNGConfiguratorWorkflowBrazilLanguage(TestUNGConfiguratorWorkflowMixin):
"""
Test UNG Configuration Workflow
"""
def test_ung_workflow_brazil(self):
""" Test the ung workflow with brazilian language """
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)
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
\ No newline at end of file
30
\ 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