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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
2d34bbea
Commit
2d34bbea
authored
May 28, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
forge: add missing tests for BusinessTemplate_createSkinFolder
parent
c1213673
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
0 deletions
+78
-0
bt5/erp5_forge/TestTemplateItem/portal_components/test.erp5.testERP5Toolbox.py
...mplateItem/portal_components/test.erp5.testERP5Toolbox.py
+78
-0
No files found.
bt5/erp5_forge/TestTemplateItem/portal_components/test.erp5.testERP5Toolbox.py
View file @
2d34bbea
...
...
@@ -81,3 +81,81 @@ class TestBusinessTemplateScripts(ERP5TypeTestCase):
'Foo Module | dummy_report_report'
),
self
.
business_template
.
getTemplateActionPathList
(),
)
def
test_BusinessTemplate_createSkinFolder
(
self
):
self
.
business_template
.
setTemplateSkinIdList
([
'existing'
])
resp
=
self
.
business_template
.
BusinessTemplate_createSkinFolder
(
skin_folder_name
=
'dummy_skin_folder'
,
skin_layer_priority
=
None
,
skin_layer_list
=
self
.
portal
.
portal_skins
.
getSkinSelections
(),
)
resp_url
=
urlparse
.
urlparse
(
resp
)
self
.
assertEqual
(
[
'Skin folder created.'
],
urlparse
.
parse_qs
(
resp_url
.
query
)[
'portal_status_message'
])
self
.
assertIn
(
'dummy_skin_folder'
,
self
.
portal
.
portal_skins
.
objectIds
())
# skin is added to business template
self
.
assertEqual
(
(
'dummy_skin_folder'
,
'existing'
),
self
.
business_template
.
getTemplateSkinIdList
())
def
test_BusinessTemplate_createSkinFolder_priority
(
self
):
resp
=
self
.
business_template
.
BusinessTemplate_createSkinFolder
(
skin_folder_name
=
'dummy_skin_folder'
,
skin_layer_priority
=
99
,
skin_layer_list
=
self
.
portal
.
portal_skins
.
getSkinSelections
(),
)
resp_url
=
urlparse
.
urlparse
(
resp
)
self
.
assertEqual
(
[
'Skin folder created.'
],
urlparse
.
parse_qs
(
resp_url
.
query
)[
'portal_status_message'
])
self
.
assertIn
(
'dummy_skin_folder'
,
self
.
portal
.
portal_skins
.
objectIds
())
self
.
assertEqual
(
99
,
self
.
portal
.
portal_skins
.
dummy_skin_folder
.
getProperty
(
'business_template_skin_layer_priority'
))
def
test_BusinessTemplate_createSkinFolder_skin_selection
(
self
):
self
.
business_template
.
setTemplateRegisteredSkinSelectionList
(
[
'existing | SelectedSkinSelection'
])
self
.
portal
.
portal_skins
.
addSkinSelection
(
'SelectedSkinSelection'
,
'erp5_core'
)
self
.
portal
.
portal_skins
.
addSkinSelection
(
'NotSelectedSkinSelection'
,
'erp5_core'
)
resp
=
self
.
business_template
.
BusinessTemplate_createSkinFolder
(
skin_folder_name
=
'dummy_skin_folder'
,
skin_layer_priority
=
99
,
skin_layer_list
=
[
'View'
,
'SelectedSkinSelection'
])
resp_url
=
urlparse
.
urlparse
(
resp
)
self
.
assertEqual
(
[
'Skin folder created.'
],
urlparse
.
parse_qs
(
resp_url
.
query
)[
'portal_status_message'
])
self
.
assertIn
(
'dummy_skin_folder'
,
self
.
portal
.
portal_skins
.
objectIds
())
skin_folders_by_skin_selection
=
{
k
:
v
.
split
(
','
)
for
(
k
,
v
)
in
self
.
portal
.
portal_skins
.
getSkinPaths
()
}
self
.
assertIn
(
'dummy_skin_folder'
,
skin_folders_by_skin_selection
[
'View'
])
self
.
assertIn
(
'dummy_skin_folder'
,
skin_folders_by_skin_selection
[
'SelectedSkinSelection'
])
self
.
assertNotIn
(
'dummy_skin_folder'
,
skin_folders_by_skin_selection
[
'NotSelectedSkinSelection'
])
self
.
assertEqual
(
[
'SelectedSkinSelection'
,
'View'
],
sorted
(
self
.
portal
.
portal_skins
.
dummy_skin_folder
.
getProperty
(
'business_template_registered_skin_selections'
)))
# skin is added to business template
self
.
assertEqual
(
(
'dummy_skin_folder | SelectedSkinSelection'
,
'dummy_skin_folder | View'
,
'existing | SelectedSkinSelection'
,
),
self
.
business_template
.
getTemplateRegisteredSkinSelectionList
())
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