From 8fd2f077b02277fff0d42ffae3d6ce7d39496486 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Wed, 27 Sep 2006 15:00:28 +0000 Subject: [PATCH] make sure to get ordered list, this prevent random fails git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10370 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../ERP5Banking/tests/testERP5BankingMonetaryIssue.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/product/ERP5Banking/tests/testERP5BankingMonetaryIssue.py b/product/ERP5Banking/tests/testERP5BankingMonetaryIssue.py index 2ba524d80d..e539884e32 100755 --- a/product/ERP5Banking/tests/testERP5BankingMonetaryIssue.py +++ b/product/ERP5Banking/tests/testERP5BankingMonetaryIssue.py @@ -157,12 +157,14 @@ class TestERP5BankingMonetaryIssue(TestERP5BankingMixin, ERP5TypeTestCase): global_dict['resource'] = self.billet_10000 line_list = [] line_1 = {} + line_1['id'] = '1' line_1['reference'] = 'unit_test_1' line_1['range_start'] = 0 line_1['range_stop'] = 100 line_1['quantity'] = 100 line_list.append(line_1) line_2 = {} + line_2['id'] = '2' line_2['reference'] = 'unit_test_2' line_2['range_start'] = 100 line_2['range_stop'] = 200 @@ -231,6 +233,9 @@ class TestERP5BankingMonetaryIssue(TestERP5BankingMixin, ERP5TypeTestCase): # get the cash container item from the monetary reception cash_container_item_list = [x.getObject() for x in self.simulation_tool.getCurrentTrackingList(node=self.reception.getRelativeUrl())] self.assertEqual(len(cash_container_item_list), 2) + def reference_sort(a,b): return cmp(a.getReference(),b.getReference()) + cash_container_item_list.sort(reference_sort) + # contruct list of dict to create cash container new_cash_container_list = [] i = 1 @@ -238,6 +243,7 @@ class TestERP5BankingMonetaryIssue(TestERP5BankingMixin, ERP5TypeTestCase): # register cash container on self to check aggregate value later setattr(self, 'cash_container_item_%s' %(str(i),), cash_container) container_dict = {} + container_dict['id'] = str(i) container_dict['reference'] = cash_container.getReference() container_dict['range_start'] = cash_container.getCashNumberRangeStart() container_dict['range_stop'] = cash_container.getCashNumberRangeStop() @@ -246,6 +252,10 @@ class TestERP5BankingMonetaryIssue(TestERP5BankingMixin, ERP5TypeTestCase): container_dict['aggregate'] = cash_container new_cash_container_list.append(container_dict) i+=1 + def reference_sort(a,b): + return cmp(a['reference'],b['reference']) + new_cash_container_list.sort(reference_sort) + global_dict = {} global_dict['emission_letter'] = 'p' -- 2.30.9