Commit 8f9b71f1 authored by Gabriel Monnerat's avatar Gabriel Monnerat

add step to remove code duplicated and clean up the code

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45029 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dc2cd9ec
############################################################################## ##############################################################################
# Copyright (c) 2011 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2011 Nexedi SA and Contributors. All Rights Reserved.
# Gabriel M. Monnerat <gabriel@tiolive.com> # Gabriel M. Monnerat <gabriel@tiolive.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsability of assessing all potential
...@@ -79,7 +79,7 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -79,7 +79,7 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
stepConfiguratorNext stepConfiguratorNext
stepTic stepTic
stepCheckConfigureMultipleUserAccountForm stepCheckConfigureMultipleUserAccountForm
stepSetupMultipleUserAccountThree%(country)s stepSetupMultipleUserAccountThree
stepConfiguratorNext stepConfiguratorNext
stepTic stepTic
stepCheckConfigurePreferenceForm stepCheckConfigurePreferenceForm
...@@ -99,6 +99,7 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -99,6 +99,7 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
stepStartConfigurationInstallation stepStartConfigurationInstallation
stepTic stepTic
stepCheckUNGWebSiteAfterInstallation stepCheckUNGWebSiteAfterInstallation
stepCheckSystemPreferenceAfterInstallation
""" """
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
...@@ -113,14 +114,14 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -113,14 +114,14 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
self.portal.portal_templates.updateRepositoryBusinessTemplateList( self.portal.portal_templates.updateRepositoryBusinessTemplateList(
['http://www.erp5.org/dists/snapshot/bt5/']) ['http://www.erp5.org/dists/snapshot/bt5/'])
def stepCreateBusinessConfiguration(self, sequence=None, sequence_list=None, **kw): def stepCreateBusinessConfiguration(self, sequence=None, sequence_list=None, **kw):
""" Create one Business Configuration """ """ Create one Business Configuration """
module = self.portal.business_configuration_module module = self.portal.business_configuration_module
business_configuration = module.newContent( business_configuration = module.newContent(
portal_type="Business Configuration", portal_type="Business Configuration",
title='Test Configurator UNG Workflow') title='Test Configurator UNG Workflow')
next_dict = {} next_dict = {}
sequence.edit(business_configuration=business_configuration, sequence.edit(business_configuration=business_configuration,
next_dict=next_dict) next_dict=next_dict)
def stepSetUNGWorkflow(self, sequence=None, sequence_list=None, **kw): def stepSetUNGWorkflow(self, sequence=None, sequence_list=None, **kw):
...@@ -214,7 +215,7 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -214,7 +215,7 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
self.assertEquals('Previous', response_dict['previous']) self.assertEquals('Previous', response_dict['previous'])
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, user_list): def _stepSetupMultipleUserAccountThree(self, sequence, user_list):
""" Generic step to create multiple user account """ """ Generic step to create multiple user account """
next_dict = {} next_dict = {}
...@@ -223,68 +224,6 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -223,68 +224,6 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
next_dict.setdefault(k, []).append(v) next_dict.setdefault(k, []).append(v)
sequence.edit(next_dict=next_dict) sequence.edit(next_dict=next_dict)
def stepSetupMultipleUserAccountThreeBrazil(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="person_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="person_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="person_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 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): def stepCheckConfigurePreferenceForm(self, sequence=None, sequence_list=None, **kw):
""" Check the multiple user account form """ """ Check the multiple user account form """
response_dict = sequence.get("response_dict") response_dict = sequence.get("response_dict")
...@@ -310,35 +249,33 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -310,35 +249,33 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
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")
# configuration is finished. We are at the Install state.
self.assertEquals('show', response_dict['command']) self.assertEquals('show', response_dict['command'])
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 stepCheckMultipleUserAccountThreeBrazil(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"]
person_config_item = person_config_save["1"] person_config_item = person_config_save["1"]
self.assertEquals(person_config_item.getReference(), "person_creator") self.assertEquals(person_config_item.getReference(), "person_creator")
person_config_item = person_config_save["2"] person_config_item = person_config_save["2"]
self.assertEquals(person_config_item.getReference(), "person_assignee") self.assertEquals(person_config_item.getReference(), "person_assignee")
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 stepCheckMultipleUserAccountThreeFrance(self, sequence=None, sequence_list=None, **kw): def stepCheckMultipleUserAccountThreeFrance(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"]
person_config_item = person_config_save["1"] person_config_item = person_config_save["1"]
self.assertEquals(person_config_item.getReference(), "french_creator") self.assertEquals(person_config_item.getReference(), "french_creator")
person_config_item = person_config_save["2"] person_config_item = person_config_save["2"]
self.assertEquals(person_config_item.getReference(), "french_assignee") self.assertEquals(person_config_item.getReference(), "french_assignee")
person_config_item = person_config_save["3"] person_config_item = person_config_save["3"]
self.assertEquals(person_config_item.getReference(), "french_assignor") 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):
...@@ -363,6 +300,12 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -363,6 +300,12 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
self.portal.portal_configurator.startInstallation( self.portal.portal_configurator.startInstallation(
business_configuration, REQUEST=self.portal.REQUEST) business_configuration, REQUEST=self.portal.REQUEST)
def stepCheckUNGWebSiteAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check System Preference"""
system_preference = portal_catalog.getResultValue(portal_type="System Preference")
self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(), 8011)
self.assertEquals(system_preference.getPreferredOoodocServerAddress(), "localhost")
class TestUNGConfiguratorWorkflowFranceLanguage(TestUNGConfiguratorWorkflowMixin): class TestUNGConfiguratorWorkflowFranceLanguage(TestUNGConfiguratorWorkflowMixin):
""" """
...@@ -376,6 +319,37 @@ class TestUNGConfiguratorWorkflowFranceLanguage(TestUNGConfiguratorWorkflowMixin ...@@ -376,6 +319,37 @@ class TestUNGConfiguratorWorkflowFranceLanguage(TestUNGConfiguratorWorkflowMixin
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def stepSetupMultipleUserAccountThree(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 stepSetupWebSiteConfiguration(self, sequence=None, sequence_list=None, **kw): def stepSetupWebSiteConfiguration(self, sequence=None, sequence_list=None, **kw):
""" Setup Web Site """ """ Setup Web Site """
next_dict = dict(your_default_available_language="fr") next_dict = dict(your_default_available_language="fr")
...@@ -413,9 +387,6 @@ class TestUNGConfiguratorWorkflowFranceLanguage(TestUNGConfiguratorWorkflowMixin ...@@ -413,9 +387,6 @@ class TestUNGConfiguratorWorkflowFranceLanguage(TestUNGConfiguratorWorkflowMixin
assignment = person.contentValues(portal_type="Assignment")[0] assignment = person.contentValues(portal_type="Assignment")[0]
self.assertEquals(assignment.getValidationState(), "open") self.assertEquals(assignment.getValidationState(), "open")
self.assertEquals(assignment.getFunction(), "function/ung_user") 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")
class TestUNGConfiguratorWorkflowBrazilLanguage(TestUNGConfiguratorWorkflowMixin): class TestUNGConfiguratorWorkflowBrazilLanguage(TestUNGConfiguratorWorkflowMixin):
""" """
...@@ -434,6 +405,37 @@ class TestUNGConfiguratorWorkflowBrazilLanguage(TestUNGConfiguratorWorkflowMixin ...@@ -434,6 +405,37 @@ class TestUNGConfiguratorWorkflowBrazilLanguage(TestUNGConfiguratorWorkflowMixin
next_dict = dict(your_default_available_language="pt-BR") next_dict = dict(your_default_available_language="pt-BR")
sequence.edit(next_dict=next_dict) sequence.edit(next_dict=next_dict)
def stepSetupMultipleUserAccountThree(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="person_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="person_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="person_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 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
...@@ -466,6 +468,3 @@ class TestUNGConfiguratorWorkflowBrazilLanguage(TestUNGConfiguratorWorkflowMixin ...@@ -466,6 +468,3 @@ class TestUNGConfiguratorWorkflowBrazilLanguage(TestUNGConfiguratorWorkflowMixin
assignment = person.contentValues(portal_type="Assignment")[0] assignment = person.contentValues(portal_type="Assignment")[0]
self.assertEquals(assignment.getValidationState(), "open") self.assertEquals(assignment.getValidationState(), "open")
self.assertEquals(assignment.getFunction(), "function/ung_user") 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
30 31
\ 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