Commit 25a51178 authored by Łukasz Nowak's avatar Łukasz Nowak

- revert 29067, as right now test report is informative enough (method id + docstring)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29759 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c6db5c80
...@@ -1355,8 +1355,10 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1355,8 +1355,10 @@ class TestTradeModelLine(TestTradeModelLineMixin):
# Tests # Tests
def test_TradeConditionTradeModelLineBasicComposition(self): def test_TradeConditionTradeModelLineBasicComposition(self):
# If Trade Condition is specialised by another Trade Condition they """
# Trade Model Lines shall be merged. If Trade Condition is specialised by another Trade Condition they
Trade Model Lines shall be merged.
"""
trade_condition_1 = self.createTradeCondition() trade_condition_1 = self.createTradeCondition()
trade_condition_2 = self.createTradeCondition() trade_condition_2 = self.createTradeCondition()
...@@ -1420,22 +1422,24 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1420,22 +1422,24 @@ class TestTradeModelLine(TestTradeModelLineMixin):
) )
def test_findSpecialiseValueList(self): def test_findSpecialiseValueList(self):
# check that findSpecialiseValueList is able to return all the inheritance '''
# model tree using Depth-first search check that findSpecialiseValueList is able to return all the inheritance
# model tree using Depth-first search
# trade_condition_1
# / \ trade_condition_1
# / \ / \
# / \ / \
# trade_condition_2 trade_condition_3 / \
# | trade_condition_2 trade_condition_3
# | |
# | |
# trade_condition_4 |
# trade_condition_4
# According to Depth-first search algorithm, result of this graph is:
# [trade_condition_1, trade_condition_2, trade_condition_3, According to Depth-first search algorithm, result of this graph is:
# trade_condition_4] [trade_condition_1, trade_condition_2, trade_condition_3,
trade_condition_4]
'''
trade_condition_1 = self.createTradeCondition() trade_condition_1 = self.createTradeCondition()
trade_condition_2 = self.createTradeCondition() trade_condition_2 = self.createTradeCondition()
trade_condition_3 = self.createTradeCondition() trade_condition_3 = self.createTradeCondition()
...@@ -1503,25 +1507,26 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1503,25 +1507,26 @@ class TestTradeModelLine(TestTradeModelLineMixin):
) )
def test_getTradeModelLineComposedList(self): def test_getTradeModelLineComposedList(self):
# Test that list of contribution/application relations is sorted to do easy traversal """Test that list of contribution/application relations is sorted to do easy traversal
#
# Let assume such graph of contribution/application dependency: Let assume such graph of contribution/application dependency:
#
# D -----> B D -----> B
# / \ / \
# E ---/ > A E ---/ > A
# / /
# F -----> C F -----> C
# / /
# G ---/ G ---/
#
# It shall return list which is sorted like: It shall return list which is sorted like:
# * (DE) B (FG) C A * (DE) B (FG) C A
# or or
# * (FG) C (DE) B A * (FG) C (DE) B A
# or or
# * (DEFG) (BC) A * (DEFG) (BC) A
# where everything in parenthesis can be not sorted where everything in parenthesis can be not sorted
"""
trade_condition = self.createTradeCondition() trade_condition = self.createTradeCondition()
A = self.createTradeModelLine(trade_condition, reference='A', A = self.createTradeModelLine(trade_condition, reference='A',
...@@ -1558,19 +1563,20 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1558,19 +1563,20 @@ class TestTradeModelLine(TestTradeModelLineMixin):
[q.getReference() for q in [G, F, E, D, C, B, A]]) [q.getReference() for q in [G, F, E, D, C, B, A]])
def test_getComplexTradeModelLineComposedList(self): def test_getComplexTradeModelLineComposedList(self):
# Test that list of contribution/application relations is sorted to do easy traversal """Test that list of contribution/application relations is sorted to do easy traversal
#
# Let assume such graph of contribution/application dependency: Let assume such graph of contribution/application dependency:
#
# /--------\ /--------\
# / \ / \
# A----+ -----B-----+-D A----+ -----B-----+-D
# \ / \ /
# \----C---/ \----C---/
#
# It shall return list which is sorted like: It shall return list which is sorted like:
# * A (BC) D * A (BC) D
# where everything in parenthesis can be not sorted where everything in parenthesis can be not sorted
"""
trade_condition = self.createTradeCondition() trade_condition = self.createTradeCondition()
C = self.createTradeModelLine(trade_condition, reference='C', C = self.createTradeModelLine(trade_condition, reference='C',
...@@ -1596,9 +1602,11 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1596,9 +1602,11 @@ class TestTradeModelLine(TestTradeModelLineMixin):
[q.getReference() for q in [A, B, C, D]]) [q.getReference() for q in [A, B, C, D]])
def test_tradeModelLineWithFixedPrice(self): def test_tradeModelLineWithFixedPrice(self):
# Check it's possible to have fixed quantity on lines. Sometimes we want """
# to say "discount 10 euros" or "pay more 10 euros" instead of saying "10% Check it's possible to have fixed quantity on lines. Sometimes we want
# discount from total" to say "discount 10 euros" or "pay more 10 euros" instead of saying "10%
discount from total"
"""
trade_condition = self.createTradeCondition() trade_condition = self.createTradeCondition()
# create a model line with 100 euros # create a model line with 100 euros
...@@ -1628,7 +1636,9 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1628,7 +1636,9 @@ class TestTradeModelLine(TestTradeModelLineMixin):
self.assertEqual(total_amount, 100 - 10) self.assertEqual(total_amount, 100 - 10)
def test_getAggregatedAmountList(self): def test_getAggregatedAmountList(self):
# Test for case, when discount contributes to tax, and order has mix of contributing lines """
Test for case, when discount contributes to tax, and order has mix of contributing lines
"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.AGGREGATED_AMOUNT_LIST_COMMON_SEQUENCE_STRING sequence_string = self.AGGREGATED_AMOUNT_LIST_COMMON_SEQUENCE_STRING
...@@ -1667,7 +1677,9 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1667,7 +1677,9 @@ class TestTradeModelLine(TestTradeModelLineMixin):
""" + AGGREGATED_AMOUNT_LIST_CHECK_SEQUENCE_STRING """ + AGGREGATED_AMOUNT_LIST_CHECK_SEQUENCE_STRING
def test_getAggregatedAmountListOrderSpecialise(self): def test_getAggregatedAmountListOrderSpecialise(self):
# Test for case, when discount contributes to tax, and order has mix of contributing lines and order itself defines Trade Model Line """
Test for case, when discount contributes to tax, and order has mix of contributing lines and order itself defines Trade Model Line
"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self\ sequence_string = self\
.ORDER_SPECIALISE_AGGREGATED_AMOUNT_COMMON_SEQUENCE_STRING .ORDER_SPECIALISE_AGGREGATED_AMOUNT_COMMON_SEQUENCE_STRING
...@@ -1676,13 +1688,15 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1676,13 +1688,15 @@ class TestTradeModelLine(TestTradeModelLineMixin):
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_getAggregatedAmountList_afterUpdateAggregatedAmountList(self): def test_getAggregatedAmountList_afterUpdateAggregatedAmountList(self):
# Test for case, when discount contributes to tax, and order has mix of contributing lines """
# Test for case, when discount contributes to tax, and order has mix of contributing lines
# Check if it is stable if updateAggregatedAmountList was invoked.
# Check if it is stable if updateAggregatedAmountList was invoked.
# Note: This test assumes, that somethings contributes after update, shall
# be rewritten in a way, that adds explicitly movement which shall Note: This test assumes, that somethings contributes after update, shall
# not be aggregated. be rewritten in a way, that adds explicitly movement which shall
not be aggregated.
"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.AGGREGATED_AMOUNT_LIST_COMMON_SEQUENCE_STRING + """ sequence_string = self.AGGREGATED_AMOUNT_LIST_COMMON_SEQUENCE_STRING + """
UpdateAggregatedAmountListOnOrder UpdateAggregatedAmountListOnOrder
...@@ -1705,14 +1719,14 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1705,14 +1719,14 @@ class TestTradeModelLine(TestTradeModelLineMixin):
""" + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING """ + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING
def test_TradeModelRuleSimulationExpand(self): def test_TradeModelRuleSimulationExpand(self):
# Tests tree of simulations from Trade Model Rule """Tests tree of simulations from Trade Model Rule"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_TradeModelRuleSimulationReexpand(self): def test_TradeModelRuleSimulationReexpand(self):
# Tests tree of simulations from Trade Model Rule with reexpanding """Tests tree of simulations from Trade Model Rule with reexpanding"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING + """ sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING + """
ModifyAgainOrderLineTaxed ModifyAgainOrderLineTaxed
...@@ -1724,8 +1738,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1724,8 +1738,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_TradeModelRuleSimulationReexpandResourceChange(self): def test_TradeModelRuleSimulationReexpandResourceChange(self):
# Tests tree of simulations from Trade Model Rule with reexpanding when """Tests tree of simulations from Trade Model Rule with reexpanding when resource changes on model"""
# resource changes on model
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING + """ sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING + """
CreateServiceTax CreateServiceTax
...@@ -1766,7 +1779,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1766,7 +1779,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_TradeModelRuleSimulationWithoutBPM(self): def test_TradeModelRuleSimulationWithoutBPM(self):
# Tests tree of simulations from Trade Model Rule when there is no BPM """Tests tree of simulations from Trade Model Rule when there is no BPM"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """ sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
CreateTradeCondition CreateTradeCondition
...@@ -1788,8 +1801,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1788,8 +1801,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_TradeModelRuleSimulationWithoutTradeCondition(self): def test_TradeModelRuleSimulationWithoutTradeCondition(self):
# Tests tree of simulations from Trade Model Rule when there is no Trade """Tests tree of simulations from Trade Model Rule when there is no Trade Condition"""
# Condition
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """ sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
CreateOrder CreateOrder
...@@ -1853,7 +1865,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1853,7 +1865,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_TradeModelRuleSimulationBuildInvoiceNewTradeCondition(self): def test_TradeModelRuleSimulationBuildInvoiceNewTradeCondition(self):
# Check that after changing trade condition invoice is diverged """Check that after changing trade condition invoice is diverged"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING
sequence_string += """ sequence_string += """
...@@ -1891,8 +1903,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1891,8 +1903,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_TradeModelRuleSimulationBuildInvoiceNewInvoiceLineSupport(self): def test_TradeModelRuleSimulationBuildInvoiceNewInvoiceLineSupport(self):
# Check how is supported addition of invoice line to invoice build from """Check how is supported addition of invoice line to invoice build from order"""
# order
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING
sequence_string += """ sequence_string += """
...@@ -1936,8 +1947,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1936,8 +1947,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_TradeModelRuleSimulationBuildInvoiceInvoiceLineModifyDivergencyAndSolving(self): def test_TradeModelRuleSimulationBuildInvoiceInvoiceLineModifyDivergencyAndSolving(self):
# Check that after changing invoice line invoice is properly diverged and """Check that after changing invoice line invoice is properly diverged and it is possible to solve"""
# it is possible to solve
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING
sequence_string += """ sequence_string += """
...@@ -1975,8 +1985,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -1975,8 +1985,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_TradeModelRuleSimulationBuildInvoiceBuildInvoiceTransactionLines(self): def test_TradeModelRuleSimulationBuildInvoiceBuildInvoiceTransactionLines(self):
# Check that having properly configured invoice transaction rule it """Check that having properly configured invoice transaction rule it invoice transaction lines are nicely generated and have proper amounts"""
# invoice transaction lines are nicely generated and have proper amounts
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING
sequence_string += """ sequence_string += """
...@@ -2049,7 +2058,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -2049,7 +2058,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
""" """
def test_TradeModelRuleSimulationPackingListSplitBuildInvoiceBuildDifferentRatio(self): def test_TradeModelRuleSimulationPackingListSplitBuildInvoiceBuildDifferentRatio(self):
# Check building invoice after splitting packing list using different ratio """Check building invoice after splitting packing list using different ratio"""
self.modified_packing_list_line_quantity_ratio = 0.4 self.modified_packing_list_line_quantity_ratio = 0.4
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_list.addSequenceString( sequence_list.addSequenceString(
...@@ -2057,35 +2066,37 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -2057,35 +2066,37 @@ class TestTradeModelLine(TestTradeModelLineMixin):
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_TradeModelRuleSimulationPackingListSplitBuildInvoiceBuild(self): def test_TradeModelRuleSimulationPackingListSplitBuildInvoiceBuild(self):
# Check building invoice after splitting packing list """Check building invoice after splitting packing list"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_list.addSequenceString( sequence_list.addSequenceString(
self.PACKING_LIST_SPLIT_INVOICE_BUILD_SEQUENCE_STRING) self.PACKING_LIST_SPLIT_INVOICE_BUILD_SEQUENCE_STRING)
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_getAggregatedAmountListWithComplexModelLinesCreateInEasyOrder(self): def test_getAggregatedAmountListWithComplexModelLinesCreateInEasyOrder(self):
# Test the return of getAggregatedAmountList in the case of many model lines """
# depending each others. In this test, lines are created in the order of the Test the return of getAggregatedAmountList in the case of many model lines
# dependencies (it means that if a line A depend of a line B, line B is depending each others. In this test, lines are created in the order of the
# created before A). This is the most easy case. dependencies (it means that if a line A depend of a line B, line B is
# created before A). This is the most easy case.
# Dependency tree :
# ModelLineTaxContributingToTotalTax : A Dependency tree :
# ModelLineDiscountContributingToTotalDiscount : B ModelLineTaxContributingToTotalTax : A
# ModelLineTaxContributingToTotalTax2 : C ModelLineDiscountContributingToTotalDiscount : B
# ModelLineTotalTax : D ModelLineTaxContributingToTotalTax2 : C
# ModelLineTotalDiscount : E ModelLineTotalTax : D
# ModelLineTotalDiscount : E
# D E
# \ / D E
# \ / \ /
# \ / \ /
# C B \ /
# \ / C B
# \ / \ /
# \/ \ /
# A \/
# Model line creation order : E, D, C, B, A A
Model line creation order : E, D, C, B, A
"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """ sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
CreateBusinessProcess CreateBusinessProcess
...@@ -2125,30 +2136,32 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -2125,30 +2136,32 @@ class TestTradeModelLine(TestTradeModelLineMixin):
sequence_list.play(self, quiet=True) sequence_list.play(self, quiet=True)
def test_getAggregatedAmountListWithComplexModelLinesCreateInRandomOrder(self): def test_getAggregatedAmountListWithComplexModelLinesCreateInRandomOrder(self):
# Test the return of getAggregatedAmountList in the case of many model lines """
# depending each others. In this test, lines are created in a random order, Test the return of getAggregatedAmountList in the case of many model lines
# not in the dependencies order (it means that if a line A depend of a depending each others. In this test, lines are created in a random order,
# line B, line A can be created before line B). getAggregatedAmountList not in the dependencies order (it means that if a line A depend of a
# should be able to handle this case and redo calculation until all line B, line A can be created before line B). getAggregatedAmountList
# dependencies are satisfied should be able to handle this case and redo calculation until all
# dependencies are satisfied
# Dependency tree :
# ModelLineTaxContributingToTotalTax : A Dependency tree :
# ModelLineDiscountContributingToTotalDiscount : B ModelLineTaxContributingToTotalTax : A
# ModelLineTaxContributingToTotalTax2 : C ModelLineDiscountContributingToTotalDiscount : B
# ModelLineTotalTax : D ModelLineTaxContributingToTotalTax2 : C
# ModelLineTotalDiscount : E ModelLineTotalTax : D
# ModelLineTotalDiscount : E
# D E
# \ / D E
# \ / \ /
# \ / \ /
# C B \ /
# \ / C B
# \ / \ /
# \/ \ /
# A \/
# Model line creation order : A, C, D, B, E A
Model line creation order : A, C, D, B, E
"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """ sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
CreateBusinessProcess CreateBusinessProcess
......
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