Commit 73b994e7 authored by Rafael Monnerat's avatar Rafael Monnerat

Drop Code Duplication on UNG and Run My Docs Configurator Tests

Drop a quite bit amount of code duplication on tests and few others
useless copy & paste duplications.

Those tests are fixed but (specially run my docs), the implementation
is a bit poor.
parent d0dac4f9
...@@ -68,7 +68,7 @@ BEFORE for possible transitions was: Enter Number of User</string> </value> ...@@ -68,7 +68,7 @@ BEFORE for possible transitions was: Enter Number of User</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Your Organisation</string> </value> <value> <string>Your organisation</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Configuration of users</string> </value> <value> <string>User accounts configuration</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -51,20 +51,20 @@ ...@@ -51,20 +51,20 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>""" This script reindex all the objects created before updating local roles """\n <value> <string>""" This script reindex all the objects created before updating local roles """\n
module_list = [\'document\',\n module_list = [\'document_module\',\n
\'image\',\n \'image_module\',\n
\'knowledge_pad\',\n \'knowledge_pad_module\',\n
\'organisation\',\n \'organisation_module\',\n
\'person\',\n \'person_module\',\n
\'review\',\n \'review_module\',\n
\'test_page\',\n \'test_page_module\',\n
\'web_page\',\n \'web_page_module\',\n
\'web_site\']\n \'web_site_module\']\n
\n \n
context.portal_types.recursiveImmediateReindexObject()\n context.portal_types.recursiveImmediateReindexObject()\n
for module_content_name in module_list:\n portal = context.getPortalObject()\n
module_name = module_content_name + \'_module\'\n for module_id in module_list:\n
module = context.restrictedTraverse(\'erp5/\' + module_name) \n module = getattr(portal, module_id)\n
module.recursiveImmediateReindexObject()\n module.recursiveImmediateReindexObject()\n
stack = [module]\n stack = [module]\n
for obj in stack:\n for obj in stack:\n
......
...@@ -26,10 +26,12 @@ ...@@ -26,10 +26,12 @@
# #
############################################################################## ##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Configurator.tests.ConfiguratorTestMixin import \
TestLiveConfiguratorWorkflowMixin
class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase): class TestRunMyDocsConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin):
""" """
Test RunMyDocs Configuration Workflow Mixin. Test RunMyDocs Configuration Workflow Mixin.
""" """
...@@ -80,25 +82,15 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -80,25 +82,15 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase):
stepCheckSystemPreferenceAfterInstallation stepCheckSystemPreferenceAfterInstallation
stepCheckUserPreferenceAfterInstallation stepCheckUserPreferenceAfterInstallation
stepCheckKnowledgePadRole stepCheckKnowledgePadRole
stepCheckCreateNewEvent
""" """
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy', return ('erp5_core_proxy_field_legacy',
'erp5_full_text_myisam_catalog', 'erp5_full_text_myisam_catalog',
'erp5_base', 'erp5_base',
'erp5_workflow', 'erp5_workflow',
'erp5_configurator', 'erp5_configurator',
'erp5_configurator_run_my_doc',) 'erp5_configurator_run_my_doc',)
def afterSetUp(self):
self.portal.portal_templates.updateRepositoryBusinessTemplateList(
['http://www.erp5.org/dists/snapshot/bt5/'])
preference = self.portal.portal_preferences.newContent(portal_type="System Preference")
preference.setTitle("global_system_preference")
preference.setPreferredOoodocServerAddress("localhost")
preference.setPreferredOoodocServerPortNumber(8011)
preference.enable()
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 """
...@@ -114,47 +106,7 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -114,47 +106,7 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase):
""" Set RunMyDocs Workflow into Business Configuration """ """ Set RunMyDocs Workflow into Business Configuration """
business_configuration = sequence.get("business_configuration") business_configuration = sequence.get("business_configuration")
self.setBusinessConfigurationWorkflow(business_configuration, self.setBusinessConfigurationWorkflow(business_configuration,
"workflow_module/runmydocs_configuration_workflow") "workflow_module/run_my_doc_configuration_workflow")
def assertCurrentStep(self, step_title, server_response):
""" Checks the current step title. """
self.assertTrue(
'<h2>%s</h2>' % step_title in server_response['data'],
'Unable to guess current step title (expected:%s) in: \n%s' %
(step_title, server_response))
def stepConfiguratorNext(self, sequence=None, sequence_list=None, **kw):
""" Go Next into Configuration """
business_configuration = sequence.get("business_configuration")
next_dict = sequence.get("next_dict")
response_dict = self.portal.portal_configurator._next(
business_configuration, next_dict)
sequence.edit(response_dict=response_dict)
def setBusinessConfigurationWorkflow(self, business_configuration, workflow):
""" Set configurator workflow """
business_configuration.setResource(workflow)
def stepCheckBT5ConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
""" Check if the Configuration Item list is correct """
business_configuration = sequence.get("business_configuration")
# second one: install some standard business templates
standard_bt5_config_save = business_configuration['1']
self.assertEquals(len(self.standard_bt5_list),
len(standard_bt5_config_save.contentValues(
portal_type='Standard BT5 Configurator Item')))
self.assertEquals(
set(self.standard_bt5_list),
set([x.bt5_id for x in standard_bt5_config_save.contentValues()]))
def stepCheckConfigureOrganisationForm(self, sequence=None, sequence_list=None, **kw):
""" Check if Confire Configure step was showed """
response_dict = sequence.get("response_dict")
if 'command' in response_dict:
self.assertEquals('show', response_dict['command'])
self.assertEquals(None, response_dict['previous'])
self.assertEquals('Configure Organisation', response_dict['next'])
self.assertCurrentStep('Your Organisation', response_dict)
def stepSetupOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw): def stepSetupOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
""" Create one Organisation with Basic information """ """ Create one Organisation with Basic information """
...@@ -166,15 +118,6 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -166,15 +118,6 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase):
field_your_default_address_zip_code='59000') field_your_default_address_zip_code='59000')
sequence.edit(next_dict=next_dict) sequence.edit(next_dict=next_dict)
def stepCheckConfigureUserAccountNumberForm(self, sequence=None, sequence_list=None, **kw):
""" """
response_dict = sequence.get("response_dict")
if 'command' in response_dict:
self.assertEquals('show', response_dict['command'])
self.assertEquals('Configure user accounts number', response_dict['next'])
self.assertEquals('Previous', response_dict['previous'])
self.assertCurrentStep('Number of user accounts', response_dict)
def stepCheckOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw): def stepCheckOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
""" Check if organisation was created fine """ """ Check if organisation was created fine """
business_configuration = sequence.get("business_configuration") business_configuration = sequence.get("business_configuration")
...@@ -193,15 +136,6 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -193,15 +136,6 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase):
next_dict = dict(field_your_user_number="3") next_dict = dict(field_your_user_number="3")
sequence.edit(next_dict=next_dict) sequence.edit(next_dict=next_dict)
def stepCheckConfigureMultipleUserAccountForm(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 _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 = {}
...@@ -217,7 +151,7 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -217,7 +151,7 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase):
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 ERP5 Preferences', response_dict['next']) self.assertEquals('Configure ERP5 Preferences', response_dict['next'])
self.assertCurrentStep('RunMyDocs Preferences', response_dict) self.assertCurrentStep('RunMyDoc Preferences', response_dict)
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 """
...@@ -235,13 +169,6 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -235,13 +169,6 @@ class TestRunMyDocsConfiguratorWorkflowMixin(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):
""" Check the installation form """
response_dict = sequence.get("response_dict")
self.assertEquals('show', response_dict['command'])
self.assertEquals('Previous', response_dict['previous'])
self.assertEquals('Install', 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")
...@@ -264,31 +191,14 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -264,31 +191,14 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase):
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):
""" Check the installation form """
response_dict = sequence.get("response_dict")
self.assertEquals('show', response_dict['command'])
def stepSetupInstallConfiguration(self, sequence=None, sequence_list=None, **kw):
""" Install the Configuration """
sequence.edit(next_dict={})
def stepCheckInstallConfiguration(self, sequence=None, sequence_list=None, **kw):
""" Check the installation of the configuration """
response_dict = sequence.get("response_dict")
self.assertEquals('install', response_dict['command'])
def stepStartConfigurationInstallation(self, sequence=None, sequence_list=None, **kw):
""" Starts the installation """
business_configuration = sequence.get("business_configuration")
self.portal.portal_configurator.startInstallation(
business_configuration, REQUEST=self.portal.REQUEST)
def stepCheckSystemPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw): def stepCheckSystemPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check System Preference""" """ Check System Preference"""
system_preference = self.portal.portal_catalog.getResultValue(portal_type="System Preference") system_preference = self.portal.portal_catalog.getResultValue(portal_type="System Preference")
self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(), 8011) conversion_dict = _getConversionServerDict()
self.assertEquals(system_preference.getPreferredOoodocServerAddress(), "localhost") self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(),
conversion_dict['port'])
self.assertEquals(system_preference.getPreferredOoodocServerAddress(),
conversion_dict['hostname'])
def stepCheckUserPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw): def stepCheckUserPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check System Preference""" """ Check System Preference"""
...@@ -302,50 +212,22 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -302,50 +212,22 @@ class TestRunMyDocsConfiguratorWorkflowMixin(ERP5TypeTestCase):
preference = portal_catalog.getResultValue(portal_type="Preference", preference = portal_catalog.getResultValue(portal_type="Preference",
title='Preference for Person Creator') title='Preference for Person Creator')
self.assertEquals(preference.getPreferenceState(), "enabled") self.assertEquals(preference.getPreferenceState(), "enabled")
runmydocs_preference = self.portal.portal_preferences.runmydocs_preference
self.assertEquals(runmydocs_preference.getPreferenceState(), "global")
def _stepCheckKnowledgePadRole(self): def _stepCheckKnowledgePadRole(self):
""" Check if Knowledge Pad is configured correctly """ """ Check if Knowledge Pad is configured correctly """
pad = self.portal.knowledge_pad_module.newContent(portal_type="Knowledge Pad") self.portal.ERP5Site_createDefaultKnowledgePadListForUser()
#pad.edit(publication_section_value=self.portal.web_site_module.runmydocs)
pad.visible()
self.stepTic()
gadget = self.portal.portal_gadgets.searchFolder()[0]
gadget_id = gadget.getId()
#self.portal.web_site_module.runmydocs.WebSection_addGadgetList(gadget_id)
self.stepTic() self.stepTic()
box_list = pad.contentValues() current_user = self.portal.portal_membership.getAuthenticatedMember().getUserName()
self.assertEquals(len(box_list), 1) pad = self.portal.portal_catalog.getResultValue(portal_type="Knowledge Pad",
knowledge_box = box_list[0] owner=current_user)
#self.assertEquals(pad.getPublicationSection(), 'web_site_module/runmydocs') gadget_uid = self.portal.portal_gadgets.test_wizard_gadget.getUid()
self.assertTrue(knowledge_box.getSpecialiseValue().getId() == gadget_id) self.portal.KnowledgePad_addBoxList(uids=[gadget_uid],
active_pad_relative_url=pad.getRelativeUrl())
def _stepCheckCreateNewEvent(self):
""" """
portal = self.portal
event_dict = dict(portal_type="Note",
title="Buy Phone",
event_text_content="testRunMyDocs Sample",
start_date_hour=11,
start_date_minute=12,
start_date_day=12,
start_date_month=02,
start_date_year=2011,
stop_date_hour=12,
stop_date_minute=12,
stop_date_day=13,
stop_date_month=02,
stop_date_year=2011)
portal.REQUEST.form.update(event_dict)
portal.event_module.EventModule_createNewEvent()
self.stepTic() self.stepTic()
event = portal.portal_catalog.getResultValue(portal_type="Note") self.assertEquals(len(pad.contentValues()), 1)
self.assertEquals(event.getDescription(), "testRunMyDocs Sample") box = pad.contentValues()[0]
start_date = event.getStartDate() self.assertEquals(box.getValidationState(), 'visible')
self.assertEquals(start_date.month(), 2) self.assertEquals(box.getSpecialise(), 'portal_gadgets/test_wizard_gadget')
self.assertEquals(start_date.minute(), 12)
class TestRunMyDocsConfiguratorWorkflowFranceLanguage(TestRunMyDocsConfiguratorWorkflowMixin): class TestRunMyDocsConfiguratorWorkflowFranceLanguage(TestRunMyDocsConfiguratorWorkflowMixin):
""" """
...@@ -394,9 +276,6 @@ class TestRunMyDocsConfiguratorWorkflowFranceLanguage(TestRunMyDocsConfiguratorW ...@@ -394,9 +276,6 @@ class TestRunMyDocsConfiguratorWorkflowFranceLanguage(TestRunMyDocsConfiguratorW
self.login("french_creator") self.login("french_creator")
self._stepCheckKnowledgePadRole() self._stepCheckKnowledgePadRole()
def stepCheckCreateNewEvent(self, sequence=None, sequence_list=None, **kw):
self.login("french_assignee")
self._stepCheckCreateNewEvent()
class TestRunMyDocsConfiguratorWorkflowBrazilLanguage(TestRunMyDocsConfiguratorWorkflowMixin): class TestRunMyDocsConfiguratorWorkflowBrazilLanguage(TestRunMyDocsConfiguratorWorkflowMixin):
...@@ -445,7 +324,3 @@ class TestRunMyDocsConfiguratorWorkflowBrazilLanguage(TestRunMyDocsConfiguratorW ...@@ -445,7 +324,3 @@ class TestRunMyDocsConfiguratorWorkflowBrazilLanguage(TestRunMyDocsConfiguratorW
def stepCheckKnowledgePadRole(self, sequence=None, sequence_list=None, **kw): def stepCheckKnowledgePadRole(self, sequence=None, sequence_list=None, **kw):
self.login("person_creator") self.login("person_creator")
self._stepCheckKnowledgePadRole() self._stepCheckKnowledgePadRole()
def stepCheckCreateNewEvent(self, sequence=None, sequence_list=None, **kw):
self.login("person_assignee")
self._stepCheckCreateNewEvent()
...@@ -69,7 +69,7 @@ nter Number of User</string> </value> ...@@ -69,7 +69,7 @@ nter Number of User</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Your Organisation</string> </value> <value> <string>Your organisation</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Configuration of users</string> </value> <value> <string>User accounts configuration</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -25,10 +25,12 @@ ...@@ -25,10 +25,12 @@
# #
############################################################################## ##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Configurator.tests.ConfiguratorTestMixin import \
TestLiveConfiguratorWorkflowMixin
class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin):
""" """
Test UNG Configuration Workflow Mixin. Test UNG Configuration Workflow Mixin.
""" """
...@@ -104,20 +106,11 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -104,20 +106,11 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy', return ('erp5_core_proxy_field_legacy',
'erp5_full_text_myisam_catalog', 'erp5_full_text_myisam_catalog',
'erp5_base', 'erp5_base',
'erp5_workflow', 'erp5_workflow',
'erp5_configurator', 'erp5_configurator',
'erp5_configurator_ung',) 'erp5_configurator_ung',)
def afterSetUp(self):
self.portal.portal_templates.updateRepositoryBusinessTemplateList(
['http://www.erp5.org/dists/snapshot/bt5/'])
preference = self.portal.portal_preferences.newContent(portal_type="System Preference")
preference.setTitle("global_system_preference")
preference.setPreferredOoodocServerAddress("localhost")
preference.setPreferredOoodocServerPortNumber(8011)
preference.enable()
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 """
...@@ -135,46 +128,6 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -135,46 +128,6 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
self.setBusinessConfigurationWorkflow(business_configuration, self.setBusinessConfigurationWorkflow(business_configuration,
"workflow_module/ung_configuration_workflow") "workflow_module/ung_configuration_workflow")
def assertCurrentStep(self, step_title, server_response):
""" Checks the current step title. """
self.assertTrue(
'<h2>%s</h2>' % step_title in server_response['data'],
'Unable to guess current step title (expected:%s) in: \n%s' %
(step_title, server_response))
def stepConfiguratorNext(self, sequence=None, sequence_list=None, **kw):
""" Go Next into Configuration """
business_configuration = sequence.get("business_configuration")
next_dict = sequence.get("next_dict")
response_dict = self.portal.portal_configurator._next(
business_configuration, next_dict)
sequence.edit(response_dict=response_dict)
def setBusinessConfigurationWorkflow(self, business_configuration, workflow):
""" Set configurator workflow """
business_configuration.setResource(workflow)
def stepCheckBT5ConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
""" Check if the Configuration Item list is correct """
business_configuration = sequence.get("business_configuration")
# second one: install some standard business templates
standard_bt5_config_save = business_configuration['1']
self.assertEquals(len(self.standard_bt5_list),
len(standard_bt5_config_save.contentValues(
portal_type='Standard BT5 Configurator Item')))
self.assertEquals(
set(self.standard_bt5_list),
set([x.bt5_id for x in standard_bt5_config_save.contentValues()]))
def stepCheckConfigureOrganisationForm(self, sequence=None, sequence_list=None, **kw):
""" Check if Confire Configure step was showed """
response_dict = sequence.get("response_dict")
if 'command' in response_dict:
self.assertEquals('show', response_dict['command'])
self.assertEquals(None, response_dict['previous'])
self.assertEquals('Configure Organisation', response_dict['next'])
self.assertCurrentStep('Your Organisation', response_dict)
def stepSetupOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw): def stepSetupOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
""" Create one Organisation with Basic information """ """ Create one Organisation with Basic information """
next_dict = dict( next_dict = dict(
...@@ -185,14 +138,6 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -185,14 +138,6 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
field_your_default_address_zip_code='59000') field_your_default_address_zip_code='59000')
sequence.edit(next_dict=next_dict) sequence.edit(next_dict=next_dict)
def stepCheckConfigureUserAccountNumberForm(self, sequence=None, sequence_list=None, **kw):
""" """
response_dict = sequence.get("response_dict")
if 'command' in response_dict:
self.assertEquals('show', response_dict['command'])
self.assertEquals('Configure user accounts number', response_dict['next'])
self.assertEquals('Previous', response_dict['previous'])
self.assertCurrentStep('Number of user accounts', response_dict)
def stepCheckOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw): def stepCheckOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
""" Check if organisation was created fine """ """ Check if organisation was created fine """
...@@ -212,15 +157,6 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -212,15 +157,6 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
next_dict = dict(field_your_user_number="3") next_dict = dict(field_your_user_number="3")
sequence.edit(next_dict=next_dict) sequence.edit(next_dict=next_dict)
def stepCheckConfigureMultipleUserAccountForm(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 _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 = {}
...@@ -230,7 +166,7 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -230,7 +166,7 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
sequence.edit(next_dict=next_dict) sequence.edit(next_dict=next_dict)
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 preference form """
response_dict = sequence.get("response_dict") response_dict = sequence.get("response_dict")
if 'command' in response_dict: if 'command' in response_dict:
self.assertEquals('show', response_dict['command']) self.assertEquals('show', response_dict['command'])
...@@ -254,13 +190,6 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -254,13 +190,6 @@ 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):
""" Check the installation form """
response_dict = sequence.get("response_dict")
self.assertEquals('show', response_dict['command'])
self.assertEquals('Previous', response_dict['previous'])
self.assertEquals('Install', 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")
...@@ -288,26 +217,14 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -288,26 +217,14 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
response_dict = sequence.get("response_dict") response_dict = sequence.get("response_dict")
self.assertEquals('show', response_dict['command']) self.assertEquals('show', response_dict['command'])
def stepSetupInstallConfiguration(self, sequence=None, sequence_list=None, **kw):
""" Install the Configuration """
sequence.edit(next_dict={})
def stepCheckInstallConfiguration(self, sequence=None, sequence_list=None, **kw):
""" Check the installation of the configuration """
response_dict = sequence.get("response_dict")
self.assertEquals('install', response_dict['command'])
def stepStartConfigurationInstallation(self, sequence=None, sequence_list=None, **kw):
""" Starts the installation """
business_configuration = sequence.get("business_configuration")
self.portal.portal_configurator.startInstallation(
business_configuration, REQUEST=self.portal.REQUEST)
def stepCheckSystemPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw): def stepCheckSystemPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check System Preference""" """ Check System Preference"""
system_preference = self.portal.portal_catalog.getResultValue(portal_type="System Preference") system_preference = self.portal.portal_catalog.getResultValue(portal_type="System Preference")
self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(), 8011) conversion_dict = _getConversionServerDict()
self.assertEquals(system_preference.getPreferredOoodocServerAddress(), "localhost") self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(),
conversion_dict['port'])
self.assertEquals(system_preference.getPreferredOoodocServerAddress(),
conversion_dict['hostname'])
def stepCheckUserPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw): def stepCheckUserPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check System Preference""" """ Check System Preference"""
...@@ -321,8 +238,8 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase): ...@@ -321,8 +238,8 @@ class TestUNGConfiguratorWorkflowMixin(ERP5TypeTestCase):
preference = portal_catalog.getResultValue(portal_type="Preference", preference = portal_catalog.getResultValue(portal_type="Preference",
title='Preference for Person Creator') title='Preference for Person Creator')
self.assertEquals(preference.getPreferenceState(), "enabled") self.assertEquals(preference.getPreferenceState(), "enabled")
ung_preference = self.portal.portal_preferences.ung_preference preference = self.portal.portal_preferences.ung_preference
self.assertEquals(ung_preference.getPreferenceState(), "global") self.assertEquals(preference.getPreferenceState(), "global")
def _stepCheckWebSiteRoles(self): def _stepCheckWebSiteRoles(self):
""" Check permission of Web Site with normal user """ """ Check permission of Web Site with normal user """
......
...@@ -133,13 +133,26 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): ...@@ -133,13 +133,26 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# it is required by SecurityTestCase # it is required by SecurityTestCase
self.workflow_tool = self.portal.portal_workflow self.workflow_tool = self.portal.portal_workflow
self.setDefaultSitePreference() self.setDefaultSitePreference()
self.setSystemPreference()
self.portal.portal_activities.unsubscribe() self.portal.portal_activities.unsubscribe()
def setSystemPreference(self):
portal_type = 'System Preference'
preference_list = self.portal.portal_preferences.contentValues(
portal_type=portal_type)
if not preference_list:
preference = self.portal.portal_preferences.newContent(
portal_type=portal_type)
else:
preference = preference_list[0]
conversion_dict = _getConversionServerDict()
preference.setPreferredOoodocServerAddress(conversion_dict['hostname'])
preference.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(preference, 'enable'):
preference.enable()
def setDefaultSitePreference(self): def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'): if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'):
default_pref.enable() default_pref.enable()
return default_pref return default_pref
...@@ -172,7 +185,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): ...@@ -172,7 +185,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
response_dict = self.portal.portal_configurator._next( response_dict = self.portal.portal_configurator._next(
business_configuration, next_dict) business_configuration, next_dict)
sequence.edit(response_dict=response_dict) sequence.edit(response_dict=response_dict)
def stepConfiguratorPrevious(self, sequence=None, sequence_list=None, **kw): def stepConfiguratorPrevious(self, sequence=None, sequence_list=None, **kw):
""" Go to the previous form. """ """ Go to the previous form. """
business_configuration = sequence.get("business_configuration") business_configuration = sequence.get("business_configuration")
...@@ -477,8 +490,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): ...@@ -477,8 +490,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
def stepSetupInstallConfiguration(self, sequence=None, sequence_list=None, **kw): def stepSetupInstallConfiguration(self, sequence=None, sequence_list=None, **kw):
""" Install the Configuration """ """ Install the Configuration """
next_dict = {} sequence.edit(next_dict={})
sequence.edit(next_dict=next_dict)
def stepCheckInstallConfiguration(self, sequence=None, sequence_list=None, **kw): def stepCheckInstallConfiguration(self, sequence=None, sequence_list=None, **kw):
""" Check the installation of the configuration """ """ Check the installation of the configuration """
......
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