Commit bf146fdb authored by Fabien Morin's avatar Fabien Morin

add a test to check that it's possible to sort result in getMovementList


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37742 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bbd831a4
......@@ -1709,6 +1709,44 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
self._testSubContentReindexing(packing_list, [container, container_line,
container_cell])
def test_PackingList_getMovementListSorting(self):
'''Test that is possible to sort getMovementList result passing it sort_on
parameter
'''
packing_list = self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
portal_type=self.packing_list_portal_type,
title='Packing List')
# create some packing list lines
line_bbb = packing_list.newContent(
portal_type=self.packing_list_line_portal_type,
reference='bbb',
int_index=1)
line_aaa = packing_list.newContent(
portal_type=self.packing_list_line_portal_type,
reference='aaa',
int_index=2)
line_ccc = packing_list.newContent(
portal_type=self.packing_list_line_portal_type,
reference='ccc',
int_index=4)
line_ddd = packing_list.newContent(
portal_type=self.packing_list_line_portal_type,
reference='ddd',
int_index=3)
transaction.commit()
self.tic()
# check it's possible to sort by reference
reference_result = packing_list.getMovementList(sort_on=\
[('reference', 'descending')])
self.assertEquals(reference_result, [line_aaa, line_bbb, line_ccc,
line_ddd])
# check it's possible to sort by int_index
int_index_result = packing_list.getMovementList(sort_on=\
[('int_index', 'ascending')])
self.assertEquals(int_index_result, [line_ccc, line_ddd, line_aaa,
line_bbb])
class TestSolvingPackingList(TestPackingListMixin, ERP5TypeTestCase):
quiet = 0
......
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