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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
817e5eb0
Commit
817e5eb0
authored
Apr 26, 2018
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testPreferences: conversion server url is list
parent
0f02c439
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
product/ERP5Form/tests/testPreferences.py
product/ERP5Form/tests/testPreferences.py
+17
-17
No files found.
product/ERP5Form/tests/testPreferences.py
View file @
817e5eb0
...
...
@@ -494,23 +494,23 @@ class TestPreferences(PropertySheetTestCase):
preference_tool
=
self
.
portal
.
portal_preferences
system_pref
=
preference_tool
.
newContent
(
portal_type
=
'System Preference'
,
preferred_document_conversion_server_url
=
'http://127.0.0.1'
,
preferred_document_conversion_server_url
_list
=
[
'http://127.0.0.1'
]
,
priority
=
Priority
.
SITE
)
# check not taken into account if not enabled
self
.
assertEqual
(
None
,
preference_tool
.
getPreferredDocumentConversionServerUrl
())
self
.
assertEqual
(
'http://localhost'
,
preference_tool
.
getPreferredDocumentConversionServerUrl
(
'http://localhost'
))
self
.
assertEqual
(
[]
,
preference_tool
.
getPreferredDocumentConversionServerUrl
List
())
self
.
assertEqual
(
[
'http://localhost'
]
,
preference_tool
.
getPreferredDocumentConversionServerUrl
List
([
'http://localhost'
]
))
self
.
assertEqual
(
default_large_image_height
,
preference_tool
.
getPreferredLargeImageHeight
())
# enable it and check preference is returned
self
.
portal
.
portal_workflow
.
doActionFor
(
system_pref
,
'enable_action'
)
self
.
assertEqual
(
system_pref
.
getPreferenceState
(),
'global'
)
self
.
tic
()
self
.
assertEqual
(
'http://127.0.0.1'
,
preference_tool
.
getPreferredDocumentConversionServerUrl
())
self
.
assertEqual
(
'http://127.0.0.1'
,
preference_tool
.
getPreferredDocumentConversionServerUrl
(
'http://localhost'
))
self
.
assertEqual
(
[
'http://127.0.0.1'
]
,
preference_tool
.
getPreferredDocumentConversionServerUrl
List
())
self
.
assertEqual
(
[
'http://127.0.0.1'
]
,
preference_tool
.
getPreferredDocumentConversionServerUrl
List
([
'http://localhost'
]
))
self
.
assertEqual
(
default_large_image_height
,
preference_tool
.
getPreferredLargeImageHeight
())
# Default value passed by parameter has priority over the default in the
...
...
@@ -526,12 +526,12 @@ class TestPreferences(PropertySheetTestCase):
# But they can see others
system_pref
.
view
()
# check accessors works
system_pref
.
setPreferredDocumentConversionServerUrl
(
'http://1.2.3.4'
)
system_pref
.
setPreferredDocumentConversionServerUrl
List
([
'http://1.2.3.4'
]
)
self
.
tic
()
self
.
assertEqual
(
'http://1.2.3.4'
,
preference_tool
.
getPreferredDocumentConversionServerUrl
())
self
.
assertEqual
(
'http://1.2.3.4'
,
preference_tool
.
getPreferredDocumentConversionServerUrl
(
'http://localhost'
))
self
.
assertEqual
(
[
'http://1.2.3.4'
]
,
preference_tool
.
getPreferredDocumentConversionServerUrl
List
())
self
.
assertEqual
(
[
'http://1.2.3.4'
]
,
preference_tool
.
getPreferredDocumentConversionServerUrl
List
([
'http://localhost'
]
))
self
.
assertEqual
(
default_large_image_height
,
preference_tool
.
getPreferredLargeImageHeight
())
...
...
@@ -544,15 +544,15 @@ class TestPreferences(PropertySheetTestCase):
self
.
portal
.
portal_workflow
.
doActionFor
(
user_pref
,
'enable_action'
)
self
.
assertEqual
(
user_pref
.
getPreferenceState
(),
'enabled'
)
self
.
tic
()
self
.
assertEqual
(
'http://1.2.3.4'
,
preference_tool
.
getPreferredDocumentConversionServerUrl
(
'http://localhost'
))
self
.
assertEqual
(
[
'http://1.2.3.4'
]
,
preference_tool
.
getPreferredDocumentConversionServerUrl
List
([
'http://localhost'
]
))
self
.
assertEqual
(
large_image_height
,
preference_tool
.
getPreferredLargeImageHeight
())
self
.
assertEqual
(
large_image_height
,
preference_tool
.
getPreferredLargeImageHeight
(
0
))
# check a user can't edit preference which are marked for manager
self
.
assertRaises
(
Unauthorized
,
user_pref
.
edit
,
preferred_document_conversion_server_url
=
"http://localhost"
)
self
.
assertRaises
(
Unauthorized
,
user_pref
.
edit
,
preferred_document_conversion_server_url
_list
=
[
"http://localhost"
]
)
# even if there is System Preference enabled getActivePreference shall return
# user preference
self
.
assertEqual
(
user_pref
,
preference_tool
.
getActivePreference
())
...
...
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