Commit 868552c3 authored by Sebastien Robin's avatar Sebastien Robin

check if searchFolder can sort correctly objects


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2739 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6397d636
......@@ -299,6 +299,32 @@ class Test(ERP5TypeTestCase):
folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()]
self.assertEquals(['4'],folder_object_list)
def test_10_OrderedSearchFolder(self, quiet=0, run=run_all_test):
if not run: return
if not quiet:
message = 'Ordered Search Folder'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
person_module = self.getPersonModule()
# Clear catalog
portal_catalog = self.getCatalogTool()
portal_catalog.manage_catalogClear()
person = person_module.newContent(id='a',portal_type='Person',title='a',description='z')
person.immediateReindexObject()
person = person_module.newContent(id='b',portal_type='Person',title='a',description='y')
person.immediateReindexObject()
person = person_module.newContent(id='c',portal_type='Person',title='a',description='x')
person.immediateReindexObject()
folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(sort_on=[('id','ascendign')])]
self.assertEquals(['a','b','c'],folder_object_list)
folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(sort_on=[('title','ascendign'),('description','ascending')])]
self.assertEquals(['c','b','a'],folder_object_list)
folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(sort_on=[('title','ascendign'),('description','descending')])]
self.assertEquals(['a','b','c'],folder_object_list)
def atest_99_BadCatalog(self, quiet=0, run=run_all_test):
"""
We should make sure that if a catalog method fails,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment