Commit f8afe1e8 authored by Julien Muchembled's avatar Julien Muchembled

Fix testLegacyTradeModelLine WRT r42117

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42133 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0d93c597
......@@ -180,9 +180,13 @@ class TestTradeModelLineMixin(TestBPMMixin, UserDict):
order.newContent(portal_type=self.order_line_portal_type, **line_kw)
return order
def getAggregatedAmountList(self, amount_generator, *args, **kw):
return amount_generator.getAggregatedAmountList(*args, **kw)
def getAggregatedAmountDict(self, amount_generator, partial_check=False,
ignore_empty_amounts=False,
**expected_amount_dict):
amount_list = amount_generator.getAggregatedAmountList()
amount_list = self.getAggregatedAmountList(amount_generator)
amount_dict = {}
for amount in amount_list:
reference = amount.getReference()
......@@ -789,7 +793,7 @@ return lambda *args, **kw: 1""")
order = self.createOrder(trade_condition, (
dict(),
))
self.assertEqual([], order.getAggregatedAmountList())
self.assertEqual([], self.getAggregatedAmountList(order))
for line in trade_condition.objectValues():
line.setBaseApplication(fixed_quantity)
amount_list = order.getAggregatedAmountList()
......
......@@ -41,6 +41,11 @@ def test_suite():
suite.addTest(unittest.makeSuite(TestComplexTradeModelLineUseCasePurchase))
return suite
def getAggregatedAmountList(self, amount_generator, *args, **kw):
kw.setdefault('generate_empty_amounts', False)
return amount_generator.getAggregatedAmountList(*args, **kw)
TestTradeModelLineMixin.getAggregatedAmountList = getAggregatedAmountList
###
## TestTradeModelLine
##
......@@ -143,6 +148,8 @@ def checkTradeModelRuleSimulationExpand(self, delivery):
['base_amount/' + use])
self.assertEqual(sm.getBaseContributionList(),
dict(discount=['base_amount/tax'], tax=[])[use])
self.assertEqual({}, result_dict)
# Ignore SM that were created from empty amounts
self.assertEqual({}, dict(x for x in result_dict.iteritems()
if x[1].getQuantity()))
TestTradeModelLine.checkTradeModelRuleSimulationExpand = \
checkTradeModelRuleSimulationExpand
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