From f2116c20187f331c3f3d53710fd184300c57e5f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Tue, 4 Aug 2009 09:07:07 +0000 Subject: [PATCH] - remove resource, as reference is used to split/merge - put related tests near git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28262 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testTradeModelLine.py | 76 ++++++++++-------------- 1 file changed, 33 insertions(+), 43 deletions(-) diff --git a/product/ERP5/tests/testTradeModelLine.py b/product/ERP5/tests/testTradeModelLine.py index 961f16f386..31da173aba 100644 --- a/product/ERP5/tests/testTradeModelLine.py +++ b/product/ERP5/tests/testTradeModelLine.py @@ -1355,9 +1355,6 @@ class TestTradeModelLine(TestTradeModelLineMixin): If Trade Condition is specialised by another Trade Condition they Trade Model Lines shall be merged. """ - service_1 = self.createResource('Service') - service_2 = self.createResource('Service') - trade_condition_1 = self.createTradeCondition() trade_condition_2 = self.createTradeCondition() @@ -1365,11 +1362,11 @@ class TestTradeModelLine(TestTradeModelLineMixin): trade_condition_1_trade_model_line = self.createTradeModelLine( trade_condition_1, - resource_value = service_1) + reference='A') trade_condition_2_trade_model_line = self.createTradeModelLine( trade_condition_2, - resource_value = service_2) + reference='B') self.assertSameSet( [trade_condition_1_trade_model_line, @@ -1377,6 +1374,37 @@ class TestTradeModelLine(TestTradeModelLineMixin): trade_condition_1.getTradeModelLineComposedList() ) + def test_TradeConditionTradeModelLineBasicCompositionWithOrder(self): + trade_condition_1 = self.createTradeCondition() + trade_condition_2 = self.createTradeCondition() + order = self.createOrder() + + trade_condition_1.setSpecialiseValue(trade_condition_2) + order.setSpecialiseValue(trade_condition_1) + + trade_condition_1_trade_model_line = self.createTradeModelLine( + trade_condition_1, + reference='A') + + trade_condition_2_trade_model_line = self.createTradeModelLine( + trade_condition_2, + reference='B') + + order_trade_model_line = self.createTradeModelLine( + order, + reference='C') + + self.assertSameSet( + [trade_condition_1_trade_model_line, trade_condition_2_trade_model_line], + trade_condition_1.getTradeModelLineComposedList() + ) + + self.assertSameSet( + [trade_condition_1_trade_model_line, trade_condition_2_trade_model_line, + order_trade_model_line], + trade_condition_1.getTradeModelLineComposedList(context=order) + ) + def test_TradeConditionCircularCompositionIsSafe(self): trade_condition_1 = self.createTradeCondition() trade_condition_2 = self.createTradeCondition() @@ -1424,44 +1452,6 @@ class TestTradeModelLine(TestTradeModelLineMixin): [trade_condition_1, trade_condition_2, trade_condition_3, trade_condition_4], speciliase_value_list) - def test_TradeConditionTradeModelLineBasicCompositionWithOrder(self): - service_1 = self.createResource('Service') - service_2 = self.createResource('Service') - service_3 = self.createResource('Service') - - trade_condition_1 = self.createTradeCondition() - trade_condition_2 = self.createTradeCondition() - order = self.createOrder() - - trade_condition_1.setSpecialiseValue(trade_condition_2) - order.setSpecialiseValue(trade_condition_1) - - trade_condition_1_trade_model_line = self.createTradeModelLine( - trade_condition_1, - reference='A', - resource_value=service_1) - - trade_condition_2_trade_model_line = self.createTradeModelLine( - trade_condition_2, - reference='B', - resource_value=service_2) - - order_trade_model_line = self.createTradeModelLine( - order, - reference='C', - resource_value=service_3) - - self.assertSameSet( - [trade_condition_1_trade_model_line, trade_condition_2_trade_model_line], - trade_condition_1.getTradeModelLineComposedList() - ) - - self.assertSameSet( - [trade_condition_1_trade_model_line, trade_condition_2_trade_model_line, - order_trade_model_line], - trade_condition_1.getTradeModelLineComposedList(context=order) - ) - def test_TradeConditionTradeModelLineReferenceIsShadowingComposition(self): trade_condition_1 = self.createTradeCondition() trade_condition_2 = self.createTradeCondition() -- 2.30.9