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
Labels
Merge Requests
7
Merge Requests
7
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
Jérome Perrin
erp5
Commits
b1365c28
Commit
b1365c28
authored
Jan 29, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor style changes
parent
0d255eb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
25 deletions
+28
-25
product/ERP5Form/tests/testListBox.py
product/ERP5Form/tests/testListBox.py
+28
-25
No files found.
product/ERP5Form/tests/testListBox.py
View file @
b1365c28
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
import
unittest
import
unittest
from
lxml
import
etree
from
lxml
import
etree
import
textwrap
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
...
@@ -162,12 +163,12 @@ class TestListBox(ERP5TypeTestCase):
...
@@ -162,12 +163,12 @@ class TestListBox(ERP5TypeTestCase):
portal
.
portal_skins
.
custom
,
portal
.
portal_skins
.
custom
,
list_method_id
,
list_method_id
,
'selection=None, sort_on=None, **kw'
,
'selection=None, sort_on=None, **kw'
,
r"""
textwrap
.
dedent
(
r"""
if sort_on != [('title', 'ASC'), ('uid', 'ASC')]:
if sort_on != [('title', 'ASC'), ('uid', 'ASC')]:
raise AssertionError('sort_on is %r' % sort_on)
raise AssertionError('sort_on is %r' % sort_on)
return []
return []
"""
)
"""
)
)
# set the listbox to use this as list method
# set the listbox to use this as list method
listbox
=
portal
.
FooModule_viewFooList
.
listbox
listbox
=
portal
.
FooModule_viewFooList
.
listbox
listbox
.
ListBox_setPropertyList
(
listbox
.
ListBox_setPropertyList
(
...
@@ -175,7 +176,7 @@ return []
...
@@ -175,7 +176,7 @@ return []
field_count_method
=
''
,
field_count_method
=
''
,
field_sort
=
'title | ASC
\
n
'
field_sort
=
'title | ASC
\
n
'
'uid | ASC'
,)
'uid | ASC'
,)
# render the listbox, checks are done by list method itself
# render the listbox, checks are done by list method itself
request
=
get_request
()
request
=
get_request
()
request
[
'here'
]
=
portal
.
foo_module
request
[
'here'
]
=
portal
.
foo_module
...
@@ -194,31 +195,32 @@ return []
...
@@ -194,31 +195,32 @@ return []
portal
.
portal_skins
.
custom
,
portal
.
portal_skins
.
custom
,
list_method_id
,
list_method_id
,
'selection=None, dummy_default_param=None, **kw'
,
'selection=None, dummy_default_param=None, **kw'
,
"""
textwrap
.
dedent
(
if dummy_default_param != 'dummy value':
"""
raise AssertionError('recieved wrong arguments: %s instead of "dummy value"'
if dummy_default_param != 'dummy value':
% dummy_default_param )
raise AssertionError('recieved wrong arguments: %s instead of "dummy value"'
return []
% dummy_default_param )
"""
)
return []
"""
))
# set the listbox to use this as list method
# set the listbox to use this as list method
listbox
=
portal
.
FooModule_viewFooList
.
listbox
listbox
=
portal
.
FooModule_viewFooList
.
listbox
listbox
.
ListBox_setPropertyList
(
listbox
.
ListBox_setPropertyList
(
field_list_method
=
list_method_id
,
field_list_method
=
list_method_id
,
field_count_method
=
''
,
field_count_method
=
''
,
field_default_params
=
'dummy_default_param | dummy value'
,)
field_default_params
=
'dummy_default_param | dummy value'
,)
# render the listbox, checks are done by list method itself
# render the listbox, checks are done by list method itself
request
=
get_request
()
request
=
get_request
()
request
[
'here'
]
=
portal
.
foo_module
request
[
'here'
]
=
portal
.
foo_module
listbox
.
get_value
(
'default'
,
render_format
=
'list'
,
REQUEST
=
request
)
listbox
.
get_value
(
'default'
,
render_format
=
'list'
,
REQUEST
=
request
)
def
test_04_UnicodeParameters
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_04_UnicodeParameters
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""Unicode properties are handled.
"""Unicode properties are handled.
"""
"""
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
portal
.
ListBoxZuite_reset
()
portal
.
ListBoxZuite_reset
()
# We create a script to use as a list method
# We create a script to use as a list method
list_method_id
=
'ListBox_ParametersListMethod'
list_method_id
=
'ListBox_ParametersListMethod'
createZODBPythonScript
(
createZODBPythonScript
(
...
@@ -226,14 +228,14 @@ return []
...
@@ -226,14 +228,14 @@ return []
list_method_id
,
list_method_id
,
'selection=None, **kw'
,
'selection=None, **kw'
,
"""return [context.asContext(alternate_title = u'
\
xe9
lisa')]"""
)
"""return [context.asContext(alternate_title = u'
\
xe9
lisa')]"""
)
# set the listbox to use this as list method
# set the listbox to use this as list method
listbox
=
portal
.
FooModule_viewFooList
.
listbox
listbox
=
portal
.
FooModule_viewFooList
.
listbox
listbox
.
ListBox_setPropertyList
(
listbox
.
ListBox_setPropertyList
(
field_list_method
=
list_method_id
,
field_list_method
=
list_method_id
,
field_count_method
=
''
,
field_count_method
=
''
,
field_columns
=
[
'alternate_title | Alternate Title'
,],)
field_columns
=
[
'alternate_title | Alternate Title'
,],)
request
=
get_request
()
request
=
get_request
()
request
[
'here'
]
=
portal
.
foo_module
request
[
'here'
]
=
portal
.
foo_module
try
:
try
:
...
@@ -503,14 +505,14 @@ return []
...
@@ -503,14 +505,14 @@ return []
field_editable_columns
=
[
'title | title'
],
field_editable_columns
=
[
'title | title'
],
field_columns
=
[
'title | Title'
,],)
field_columns
=
[
'title | Title'
,],)
form
.
manage_addField
(
'listbox_title'
,
'Title'
,
'StringField'
)
form
.
manage_addField
(
'listbox_title'
,
'Title'
,
'StringField'
)
createZODBPythonScript
(
createZODBPythonScript
(
portal
.
portal_skins
.
custom
,
portal
.
portal_skins
.
custom
,
list_method_id
,
list_method_id
,
'selection=None, **kw'
,
'selection=None, **kw'
,
"from Products.PythonScripts.standard import Object
\
n
"
"from Products.PythonScripts.standard import Object
\
n
"
"return [Object(uid='new_', title='Object Title')]"
)
"return [Object(uid='new_', title='Object Title')]"
)
request
=
get_request
()
request
=
get_request
()
request
[
'here'
]
=
portal
.
foo_module
request
[
'here'
]
=
portal
.
foo_module
line_list
=
[
l
for
l
in
listbox
.
get_value
(
'default'
,
line_list
=
[
l
for
l
in
listbox
.
get_value
(
'default'
,
...
@@ -531,7 +533,7 @@ return []
...
@@ -531,7 +533,7 @@ return []
listbox
.
ListBox_setPropertyList
(
listbox
.
ListBox_setPropertyList
(
field_list_method
=
'contentValues'
,
field_list_method
=
'contentValues'
,
field_columns
=
[
'listbox_value | Title'
,],)
field_columns
=
[
'listbox_value | Title'
,],)
# create a form, to store our proxy field inside
# create a form, to store our proxy field inside
portal
.
_setObject
(
'Test_view'
,
portal
.
_setObject
(
'Test_view'
,
ERP5Form
(
'Test_view'
,
'View'
))
ERP5Form
(
'Test_view'
,
'View'
))
...
@@ -544,7 +546,7 @@ return []
...
@@ -544,7 +546,7 @@ return []
# this proxy field will not delegate its "columns" value
# this proxy field will not delegate its "columns" value
proxy_field
.
_surcharged_edit
(
dict
(
columns
=
[(
'proxy_value'
,
'Proxy'
)]),
proxy_field
.
_surcharged_edit
(
dict
(
columns
=
[(
'proxy_value'
,
'Proxy'
)]),
[
'columns'
])
[
'columns'
])
request
=
get_request
()
request
=
get_request
()
request
[
'here'
]
=
portal
.
foo_module
request
[
'here'
]
=
portal
.
foo_module
line_list
=
proxy_field
.
get_value
(
'default'
,
line_list
=
proxy_field
.
get_value
(
'default'
,
...
@@ -584,7 +586,8 @@ return []
...
@@ -584,7 +586,8 @@ return []
renderer
.
getSelectedColumnList
())
renderer
.
getSelectedColumnList
())
# default(no list_style)
# default(no list_style)
self
.
assertEqual
(
getListBoxRenderer
(
listbox
).
getDefaultDisplayStyle
(),
getListBoxRenderer
(
listbox
).
getListboxDisplayStyle
())
self
.
assertEqual
(
getListBoxRenderer
(
listbox
).
getDefaultDisplayStyle
(),
getListBoxRenderer
(
listbox
).
getListboxDisplayStyle
())
self
.
assertSameSet
([(
'id'
,
u'ID'
),
(
'title'
,
u'Title'
),
(
'getQuantity'
,
u'Quantity'
)],
self
.
assertSameSet
([(
'id'
,
u'ID'
),
(
'title'
,
u'Title'
),
(
'getQuantity'
,
u'Quantity'
)],
getListBoxRenderer
(
listbox
).
getSelectedColumnList
())
getListBoxRenderer
(
listbox
).
getSelectedColumnList
())
...
@@ -620,7 +623,7 @@ return []
...
@@ -620,7 +623,7 @@ return []
request
.
set
(
'list_style'
,
'table'
)
request
.
set
(
'list_style'
,
'table'
)
self
.
assertSameSet
([(
'id'
,
u'ID'
),
(
'title'
,
u'Title'
),
(
'getQuantity'
,
u'Quantity'
)],
self
.
assertSameSet
([(
'id'
,
u'ID'
),
(
'title'
,
u'Title'
),
(
'getQuantity'
,
u'Quantity'
)],
getListBoxRenderer
(
listbox
).
getSelectedColumnList
())
getListBoxRenderer
(
listbox
).
getSelectedColumnList
())
def
test_ListboxRequestParameterPropagandation
(
self
):
def
test_ListboxRequestParameterPropagandation
(
self
):
"""
"""
Test that rendering a listbox field will set respective form & field_id of current form
Test that rendering a listbox field will set respective form & field_id of current form
...
...
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