Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
a29761e3
Commit
a29761e3
authored
Dec 01, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: Clean up Skin Selection tests
This makes easy to overwrite and custom the list on sub-level projects
parent
7918f6c7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
142 additions
and
189 deletions
+142
-189
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SkinSelection.py
...ortal_components/test.erp5.testSlapOSERP5SkinSelection.py
+142
-189
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SkinSelection.py
View file @
a29761e3
...
...
@@ -19,43 +19,18 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
unittest
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
import
difflib
class
TestSlaposSkinSelection
(
SlapOSTestCaseMixin
):
run_all_test
=
1
class
TestSlaposSkinSelectionMixin
(
SlapOSTestCaseMixin
):
# Ignore these bt5 as they might be present on development instances
# but not present on the test.
ignore_list
=
[
# UI testing folders not deployed by Configurator
"slapos_ui_test"
,
"slapos_ui_test"
]
# Legacy and/or custom bt5 folders
"slapos_vifib"
,
"rapid_space"
,
"rapid_space_ui_test"
]
def
getTitle
(
self
):
return
"Slapos Skin Selection"
def
test_01_defaultSkin
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check default skin
"""
if
not
run
:
return
self
.
assertSameSet
(
self
.
portal
.
portal_skins
.
getDefaultSkin
(),
'View'
)
def
test_01_availableSkin
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check that available skins are the same than production server
"""
if
not
run
:
return
portal
=
self
.
getPortal
()
self
.
assertSameSet
(
[
x
[
0
]
for
x
in
portal
.
portal_skins
.
getSkinPaths
()],
[
expected_available_skin
=
[
'Deferred'
,
'Deploy'
,
'Download'
,
...
...
@@ -73,50 +48,8 @@ class TestSlaposSkinSelection(SlapOSTestCaseMixin):
'SlideShow'
,
'View'
]
)
def
assertSameSkinSelection
(
self
,
skin_name
,
selection_string_list
):
if
selection_string_list
.
startswith
(
'
\
n
'
):
selection_string_list
=
selection_string_list
[
1
:]
if
selection_string_list
.
endswith
(
'
\
n
'
):
selection_string_list
=
selection_string_list
[:
-
1
]
installed_selection_string_list
=
\
self
.
portal
.
portal_skins
.
getSkinPath
(
skin_name
)
selection_string_list
=
selection_string_list
.
split
(
'
\
n
'
)
installed_selection_string_list
=
\
[
i
for
i
in
installed_selection_string_list
.
split
(
','
)
if
i
not
in
self
.
ignore_list
]
if
selection_string_list
!=
installed_selection_string_list
:
message
=
'
\
n
Skin "%s" is different from production server:
\
n
'
%
skin_name
for
line
in
difflib
.
unified_diff
(
selection_string_list
,
installed_selection_string_list
):
message
+=
'
\
t
%s
\
n
'
%
line
message
+=
'
\
n
'
message
+=
'Removed skin folder:
\
n
'
for
i
in
[
x
for
x
in
selection_string_list
if
x
not
in
installed_selection_string_list
]:
message
+=
'
\
t
- %s
\
n
'
%
i
message
+=
'Added skin folder:
\
n
'
for
i
in
[
x
for
x
in
installed_selection_string_list
if
x
not
in
selection_string_list
]:
message
+=
'
\
t
+ %s
\
n
'
%
i
self
.
fail
(
message
)
def
test_092_RedirectAssist_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'RedirectAssist'
selection_string_list
=
\
redirect_assistant_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -227,18 +160,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_091_Deffered_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'Deferred'
selection_string_list
=
\
deffered_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -348,17 +271,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_09_Deploy_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'Deploy'
selection_string_list
=
\
deploy_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -469,16 +383,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_08_View_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'View'
selection_string_list
=
\
view_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -590,16 +496,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_10_KM_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'KM'
selection_string_list
=
\
km_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -712,16 +610,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_11_Multiflex_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'Multiflex'
selection_string_list
=
\
multiflex_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -831,16 +721,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_12_Download_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'Download'
selection_string_list
=
\
download_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -951,16 +833,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_13_ODS_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'ODS'
selection_string_list
=
\
ods_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -1070,16 +944,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_14_ODT_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'ODT'
selection_string_list
=
\
odt_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -1189,16 +1055,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_15_RSS_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'RSS'
selection_string_list
=
\
rss_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -1309,16 +1167,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_16_SHACACHE_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'SHACACHE'
selection_string_list
=
\
shadir_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -1342,7 +1192,7 @@ slapos_simulation
slapos_slap_tool
slapos_wechat
slapos_configurator
erp5_web_sha
cache
erp5_web_sha
dir
erp5_km
erp5_web_download_theme
erp5_knowledge_pad
...
...
@@ -1430,16 +1280,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_17_SHADIR_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'SHADIR'
selection_string_list
=
\
shacache_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -1463,7 +1305,7 @@ slapos_simulation
slapos_slap_tool
slapos_wechat
slapos_configurator
erp5_web_sha
dir
erp5_web_sha
cache
erp5_km
erp5_web_download_theme
erp5_knowledge_pad
...
...
@@ -1551,16 +1393,8 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
test_18_RJS_selection
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Check the skin folder order
"""
if
not
run
:
return
skin_name
=
'RJS'
selection_string_list
=
\
rjs_selection_string_list
=
\
"""
custom
erp5_font
...
...
@@ -1671,10 +1505,129 @@ external_method
slapos_disaster_recovery
Images
"""
self
.
assertSameSkinSelection
(
skin_name
,
selection_string_list
)
def
getTitle
(
self
):
return
"Slapos Skin Selection"
def
test_01_defaultSkin
(
self
):
"""
Check default skin
"""
self
.
assertSameSet
(
self
.
portal
.
portal_skins
.
getDefaultSkin
(),
'View'
)
def
assertSameSkinSelection
(
self
,
skin_name
,
selection_string_list
):
if
selection_string_list
.
startswith
(
'
\
n
'
):
selection_string_list
=
selection_string_list
[
1
:]
if
selection_string_list
.
endswith
(
'
\
n
'
):
selection_string_list
=
selection_string_list
[:
-
1
]
installed_selection_string_list
=
\
self
.
portal
.
portal_skins
.
getSkinPath
(
skin_name
)
selection_string_list
=
selection_string_list
.
split
(
'
\
n
'
)
installed_selection_string_list
=
\
[
i
for
i
in
installed_selection_string_list
.
split
(
','
)
if
i
not
in
self
.
ignore_list
]
if
selection_string_list
!=
installed_selection_string_list
:
message
=
'
\
n
Skin "%s" is different from production server:
\
n
'
%
skin_name
for
line
in
difflib
.
unified_diff
(
selection_string_list
,
installed_selection_string_list
):
message
+=
'
\
t
%s
\
n
'
%
line
message
+=
'
\
n
'
message
+=
'Removed skin folder:
\
n
'
for
i
in
[
x
for
x
in
selection_string_list
if
x
not
in
installed_selection_string_list
]:
message
+=
'
\
t
- %s
\
n
'
%
i
message
+=
'Added skin folder:
\
n
'
for
i
in
[
x
for
x
in
installed_selection_string_list
if
x
not
in
selection_string_list
]:
message
+=
'
\
t
+ %s
\
n
'
%
i
self
.
fail
(
message
)
def
_test_01_availableSkin
(
self
):
"""
Check that available skins are the same than production server
"""
portal
=
self
.
getPortal
()
self
.
assertSameSet
(
[
x
[
0
]
for
x
in
portal
.
portal_skins
.
getSkinPaths
()],
self
.
expected_available_skin
)
def
_test_092_RedirectAssist_selection
(
self
):
self
.
assertSameSkinSelection
(
'RedirectAssist'
,
self
.
redirect_assistant_selection_string_list
)
def
_test_091_Deffered_selection
(
self
):
self
.
assertSameSkinSelection
(
'Deferred'
,
self
.
deffered_selection_string_list
)
def
_test_09_Deploy_selection
(
self
):
self
.
assertSameSkinSelection
(
"Deploy"
,
self
.
deploy_selection_string_list
)
def
_test_08_View_selection
(
self
):
self
.
assertSameSkinSelection
(
'View'
,
self
.
view_selection_string_list
)
def
_test_10_KM_selection
(
self
):
self
.
assertSameSkinSelection
(
"KM"
,
self
.
km_selection_string_list
)
def
_test_11_Multiflex_selection
(
self
):
self
.
assertSameSkinSelection
(
"Multiflex"
,
self
.
multiflex_selection_string_list
)
def
_test_12_Download_selection
(
self
):
self
.
assertSameSkinSelection
(
"Download"
,
self
.
download_selection_string_list
)
def
_test_13_ODS_selection
(
self
):
self
.
assertSameSkinSelection
(
"ODS"
,
self
.
ods_selection_string_list
)
def
_test_14_ODT_selection
(
self
):
self
.
assertSameSkinSelection
(
"ODT"
,
self
.
odt_selection_string_list
)
def
_test_15_RSS_selection
(
self
):
self
.
assertSameSkinSelection
(
"RSS"
,
self
.
rss_selection_string_list
)
def
_test_16_SHACACHE_selection
(
self
):
self
.
assertSameSkinSelection
(
"SHACACHE"
,
self
.
shacache_selection_string_list
)
def
_test_17_SHADIR_selection
(
self
):
self
.
assertSameSkinSelection
(
"SHADIR"
,
self
.
shadir_selection_string_list
)
def
_test_18_RJS_selection
(
self
):
self
.
assertSameSkinSelection
(
"RJS"
,
self
.
rjs_selection_string_list
)
class
TestSlaposSkinSelection
(
TestSlaposSkinSelectionMixin
):
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestSlaposSkinSelection
))
return
suite
test_01_availableSkin
=
TestSlaposSkinSelectionMixin
.
_test_01_availableSkin
test_092_RedirectAssist_selection
=
TestSlaposSkinSelectionMixin
.
_test_092_RedirectAssist_selection
test_091_Deffered_selection
=
TestSlaposSkinSelectionMixin
.
_test_091_Deffered_selection
test_09_Deploy_selection
=
TestSlaposSkinSelectionMixin
.
_test_09_Deploy_selection
test_08_View_selection
=
TestSlaposSkinSelectionMixin
.
_test_08_View_selection
test_10_KM_selection
=
TestSlaposSkinSelectionMixin
.
_test_10_KM_selection
test_11_Multiflex_selection
=
TestSlaposSkinSelectionMixin
.
_test_11_Multiflex_selection
test_12_Download_selection
=
TestSlaposSkinSelectionMixin
.
_test_12_Download_selection
test_13_ODS_selection
=
TestSlaposSkinSelectionMixin
.
_test_13_ODS_selection
test_14_ODT_selection
=
TestSlaposSkinSelectionMixin
.
_test_14_ODT_selection
test_15_RSS_selection
=
TestSlaposSkinSelectionMixin
.
_test_15_RSS_selection
test_16_SHACACHE_selection
=
TestSlaposSkinSelectionMixin
.
_test_16_SHACACHE_selection
test_17_SHADIR_selection
=
TestSlaposSkinSelectionMixin
.
_test_17_SHADIR_selection
test_18_RJS_selection
=
TestSlaposSkinSelectionMixin
.
_test_18_RJS_selection
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