Commit 2d660373 authored by Romain Courteaud's avatar Romain Courteaud

Check expand of a hierachical order.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17234 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b073bc4d
...@@ -697,17 +697,7 @@ class TestOrderMixin: ...@@ -697,17 +697,7 @@ class TestOrderMixin:
sequence.edit(simulation_movement_list=simulation_movement_list) sequence.edit(simulation_movement_list=simulation_movement_list)
# Count the number of movement in order # Count the number of movement in order
order_line_list = order.objectValues( \ movement_list = order.getMovementList()
portal_type=self.order_line_portal_type)
order_line_list = [x.getObject() for x in order_line_list]
movement_list = []
for order_line in order_line_list:
if not order_line.hasCellContent():
movement_list.append(order_line)
else:
cell_list = order_line.objectValues( \
portal_type=self.order_cell_portal_type)
movement_list.extend([x.getObject() for x in cell_list])
# Check if number of movement is equal to number of simulation movement # Check if number of movement is equal to number of simulation movement
self.assertEquals(len(movement_list), len(simulation_movement_list)) self.assertEquals(len(movement_list), len(simulation_movement_list))
# Check if each movement has only one simulation movement related # Check if each movement has only one simulation movement related
...@@ -1942,6 +1932,99 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1942,6 +1932,99 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
*cell_key) *cell_key)
self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList())) self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList()))
def stepCreateSubOrderLine(self,sequence=None, sequence_list=None, **kw):
"""
Create a empty order line
"""
order = sequence.get('order')
# Create sub line in the first order line
order_line = \
order.contentValues(portal_type=self.order_line_portal_type)[0]
sub_order_line = order_line.newContent(
portal_type=self.order_line_portal_type,
title="Sub Order Line")
sequence.edit(order_line=sub_order_line,
sub_order_line=sub_order_line)
def stepCreateSubSubOrderLine(self,sequence=None, sequence_list=None, **kw):
"""
Create a empty order line
"""
sub_order_line = sequence.get('sub_order_line')
# Create sub line in the first sub order line
order_line = sub_order_line.newContent(
portal_type=self.order_line_portal_type,
title="Sub Order Line")
sequence.edit(order_line=order_line)
def test_20_testHierarchicalOrderAppliedRuleGeneration(self, quiet=0,
run=run_all_test):
"""
Test generation and update of an hierarchical order applied rule.
"""
if not run: return
sequence_list = SequenceList()
hierarchical_order_creation = '\
stepCreateOrder \
stepCreateNotVariatedResource \
stepCreateOrderLine \
stepCheckOrderLineEmptyMatrix \
stepSetOrderLineResource \
stepSetOrderLineDefaultValues \
stepCheckOrderLineDefaultValues \
\
stepCreateSubOrderLine \
stepCheckOrderLineEmptyMatrix \
stepSetOrderLineResource \
stepSetOrderLineDefaultValues \
stepCheckOrderLineDefaultValues \
\
stepCreateSubSubOrderLine \
stepCheckOrderLineEmptyMatrix \
stepSetOrderLineResource \
stepSetOrderLineDefaultValues \
stepCheckOrderLineDefaultValues \
\
stepCreateSubSubOrderLine \
stepCheckOrderLineEmptyMatrix \
stepSetOrderLineResource \
stepSetOrderLineDefaultValues \
stepCheckOrderLineDefaultValues \
\
stepCreateSubOrderLine \
stepCheckOrderLineEmptyMatrix \
stepSetOrderLineResource \
stepSetOrderLineDefaultValues \
stepCheckOrderLineDefaultValues \
\
stepCreateOrderLine \
stepCheckOrderLineEmptyMatrix \
stepSetOrderLineResource \
stepSetOrderLineDefaultValues \
stepCheckOrderLineDefaultValues \
'
# Test when order is cancelled
sequence_string = '\
stepCreateOrganisation \
' + hierarchical_order_creation + '\
stepCheckOrderSimulation \
stepPlanOrder \
stepTic \
stepCheckOrderSimulation \
stepOrderOrder \
stepTic \
stepCheckOrderSimulation \
stepCancelOrder \
stepTic \
stepCheckOrderSimulation \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestOrder)) suite.addTest(unittest.makeSuite(TestOrder))
......
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