[Erp5-report] r8483 - /erp5/trunk/products/ERP5Form/tests/testListBox.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Jul 18 15:06:18 CEST 2006
Author: jerome
Date: Tue Jul 18 15:06:14 2006
New Revision: 8483
URL: http://svn.erp5.org?rev=8483&view=rev
Log:
add a test for default sort:
sort_on parameter is passed as a keyword argument to the list method
Modified:
erp5/trunk/products/ERP5Form/tests/testListBox.py
Modified: erp5/trunk/products/ERP5Form/tests/testListBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/tests/testListBox.py?rev=8483&r1=8482&r2=8483&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/tests/testListBox.py (original)
+++ erp5/trunk/products/ERP5Form/tests/testListBox.py Tue Jul 18 15:06:14 2006
@@ -36,6 +36,7 @@
from Products.ERP5Type.tests.Sequence import SequenceList
from Testing import ZopeTestCase
from Products.ERP5Type.Utils import get_request
+from Products.ERP5Type.tests.utils import createZODBPythonScript
class TestListBox(ERP5TypeTestCase):
"""
@@ -82,7 +83,9 @@
def stepModifyListBoxForStat(self, sequence = None, sequence_list = None, **kw):
portal = self.getPortal()
listbox = portal.FooModule_viewFooList.listbox
- message = listbox.ListBox_setPropertyList(field_stat_columns = 'id|FooModule_statId\ntitle|FooModule_statTitle', field_stat_method = 'portal_catalog')
+ message = listbox.ListBox_setPropertyList(
+ field_stat_columns = 'id|FooModule_statId\ntitle|FooModule_statTitle',
+ field_stat_method = 'portal_catalog')
self.failUnless('Set Successfully' in message)
def stepRenderList(self, sequence = None, sequence_list = None, **kw):
@@ -137,7 +140,41 @@
CheckListBoxLineListWithStat \
'
sequence_list.addSequenceString(sequence_string)
- sequence_list.play(self)
+ sequence_list.play(self, quiet=quiet)
+
+ def test_02_DefaultSort(self, quiet=0, run=run_all_test):
+ """Defaults sort parameters must be passed to the list method, under the
+ 'sort_on' key.
+ """
+ portal = self.getPortal()
+ portal.ListBoxZuite_reset()
+
+ # We create a script to use as a list method, in this script, we will check
+ # the sort_on parameter.
+ list_method_id = 'ListBox_checkSortOnListmethod'
+ createZODBPythonScript(
+ portal.portal_skins.custom,
+ list_method_id,
+ 'selection=None, sort_on=None, **kw',
+r"""
+assert sort_on == [('title', 'ASC'), ('uid', 'ASC')],\
+ 'sort_on is %r' % sort_on
+return []
+""")
+
+ # set the listbox to use this as list method
+ listbox = portal.FooModule_viewFooList.listbox
+ message = listbox.ListBox_setPropertyList(
+ field_list_method = list_method_id,
+ field_sort = 'title | ASC\n'
+ 'uid | ASC',)
+ self.failUnless('Set Successfully' in message)
+
+ # render the listbox, checks are done by list method itself
+ request = get_request()
+ request['here'] = portal.foo_module
+ listboxline_list = listbox.get_value('default', render_format = 'list',
+ REQUEST = request)
if __name__ == '__main__':
framework()
More information about the Erp5-report
mailing list