Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
f19b3a4b
Commit
f19b3a4b
authored
Feb 11, 2016
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_upgrader: add a test for the new renaming feature
parent
827e354b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
bt5/erp5_upgrader/TestTemplateItem/portal_components/test.erp5.testUpgrader.py
...tTemplateItem/portal_components/test.erp5.testUpgrader.py
+76
-0
No files found.
bt5/erp5_upgrader/TestTemplateItem/portal_components/test.erp5.testUpgrader.py
View file @
f19b3a4b
...
...
@@ -434,6 +434,58 @@ class TestUpgrader(ERP5TypeTestCase):
self.fail("
checkConsistency
should
not
raise
exception
.
"
"
It
means
that
one
Business
Template
was
not
found
in
repositories
")
def stepCreateOrganisationWithActivity(self, sequence=None):
new_organisation = self.portal.organisation_module.newContent(
portal_type="
Organisation
",
title="
Active
Organisation
",
activity="
education
")
self.tic()
self.assertEqual(new_organisation.getCategoriesList(),
['activity/education'])
sequence.set('organisation', new_organisation)
def stepCreateCustomUpgradeCategoryList(self, sequence=None):
portal = self.portal
skin_folder = portal.portal_skins.custom
script_id = "
Base_getUpgradeCategoryNameList
"
skin_folder.manage_addProduct['PythonScripts'].manage_addPythonScript(script_id)
custom_script = getattr(skin_folder, script_id)
script_body = "
return
((
'activity'
,
'business_core'
),)
"
custom_script.ZPythonScript_edit('', script_body)
def stepRemoveCustomUpgradeCategoryList(self, sequence=None):
custom_folder = self.portal.portal_skins.custom
custom_folder.manage_delObjects("
Base_getUpgradeCategoryNameList
")
def stepRenameCategoryActivityToBusinessCore(self, sequence=None):
"""Renames the category 'activity' to 'business_core'"""
self.portal.portal_categories.activity.edit(
id="
business_core
",
title="
Business
Core
")
def stepUpdateOrganisationPropertySheetManually(self, sequence=None):
"""
Changes the category property Activity of an Organisation to Business Core.
This step is made manually in the step, but in a real case the old property
sheet would be replaced by a new one saved in a business template to upgrade
"""
activity = self.portal.portal_property_sheets.Organisation.activity_category
activity.edit(id="
business_core_category
",
title= "
business_core
",
reference="
business_core
")
def stepCheckOrganisationObjectUpdated(self, sequence=None):
self.assertEqual(sequence.get('organisation').getCategoriesList(),
['business_core/education'])
def stepCheckPostUpgradeCategoryName(self, sequence=None):
alarm = getattr(self.portal.portal_alarms, 'upgrader_check_post_upgrade')
active_process = alarm.getLastActiveProcess()
detail_list = active_process.getResultList()[0].detail
message = 'Portal Type Organisation still contains the category activity'
self.assertTrue(message in detail_list, detail_list)
self.assertTrue(detail_list.count(message), 1)
def test_workflow_chain_constraint(self):
""" Check if Workflow chains is broken, it can be detected and fixed after
upgrade"""
...
...
@@ -633,3 +685,27 @@ class TestUpgrader(ERP5TypeTestCase):
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_rename_category(self):
"""Check that the renaming category feature correctly updates objects"""
self.portal.portal_categories.Folder_reindexAll()
self.tic()
sequence_list = SequenceList()
sequence_string = """
stepCreateOrganisationWithActivity
stepCreateCustomUpgradeCategoryList
stepRenameCategoryActivityToBusinessCore
stepUpdateOrganisationPropertySheetManually
stepTic
stepActiveSensePreUpgradeAlarm
stepActiveSensePostUpgradeAlarm
stepTic
stepRunUpgrader
stepTic
stepRunPostUpgrade
stepTic
stepCheckOrganisationObjectUpdated
stepRemoveCustomUpgradeCategoryList
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment