Commit c4ed0d20 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

add tests that checks new behaviour (i.e. no longer using 'order' category in...

add tests that checks new behaviour (i.e. no longer using 'order' category in top level simulation movements.)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32526 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0845f16c
......@@ -262,7 +262,7 @@ class TestInvoiceMixin(TestPackingListMixin,
invoice_transaction_rule_list = []
for order_rule in order_rule_list :
for order_simulation_movement in order_rule.objectValues() :
temp_invoicing_rule_list = [ar for ar in order_simulation_movement.objectValues()
temp_invoicing_rule_list = [ar for ar in order_simulation_movement.objectValues()[0].objectValues()[0].objectValues()
if ar.getSpecialiseValue().getPortalType() == 'Invoicing Rule']
self.assertEquals(len(temp_invoicing_rule_list), 1)
invoicing_rule_list.extend(temp_invoicing_rule_list)
......@@ -379,7 +379,9 @@ class TestInvoice(TestInvoiceMixin):
related_applied_rule = order.getCausalityRelatedValue(
portal_type='Applied Rule')
delivery_movement = related_applied_rule.contentValues()[0]
order_movement = related_applied_rule.contentValues()[0]
delivery_applied_rule = order_movement.contentValues()[0]
delivery_movement = delivery_applied_rule.contentValues()[0]
invoice_applied_rule = delivery_movement.contentValues()[0]
invoice_movement = invoice_applied_rule.contentValues()[0]
invoice_transaction_applied_rule = invoice_movement.contentValues()[0]
......@@ -644,7 +646,9 @@ class TestInvoice(TestInvoiceMixin):
related_applied_rule = order.getCausalityRelatedValue(
portal_type='Applied Rule')
delivery_movement = related_applied_rule.contentValues()[0]
order_movement = related_applied_rule.contentValues()[0]
delivery_applied_rule = order_movement.contentValues()[0]
delivery_movement = delivery_applied_rule.contentValues()[0]
invoice_applied_rule = delivery_movement.contentValues()[0]
invoice_movement = invoice_applied_rule.contentValues()[0]
invoice_transaction_applied_rule = invoice_movement.contentValues()[0]
......@@ -2444,6 +2448,10 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
rule_dict = {
'Order Rule': {
'movement_type_list': ['Sale Order Line', 'Sale Order Cell'],
'next_rule_list': ['Delivering Rule', ],
},
'Delivering Rule': {
'movement_type_list': ['Sale Packing List Line', 'Sale Packing List Cell'],
'next_rule_list': ['Invoicing Rule', ],
},
......
......@@ -804,13 +804,13 @@ class TestOrderMixin:
# Check if number of movement is equal to number of simulation movement
self.assertEquals(len(movement_list), len(simulation_movement_list))
# Check if each movement has only one simulation movement related
order_movement_list = [x.getOrderValue() for x in \
order_movement_list = [x.getDeliveryValue() for x in \
simulation_movement_list]
self.failIfDifferentSet(movement_list, order_movement_list)
# Check each simulation movement
for simulation_movement in simulation_movement_list:
order_movement = simulation_movement.getOrderValue()
order_movement = simulation_movement.getDeliveryValue()
# Test quantity
self.assertEquals(order_movement.getQuantity(), \
simulation_movement.getQuantity())
......@@ -946,9 +946,23 @@ class TestOrderMixin:
# First, test if each Simulation Movement is related to a Packing List
# Movement
order_relative_url = order.getRelativeUrl()
packing_list_relative_url = packing_list.getRelativeUrl()
for simulation_movement in simulation_movement_list:
packing_list_movement_list = simulation_movement.getDeliveryValueList()
order_movement_list = simulation_movement.getDeliveryValueList()
self.failUnless(len(order_movement_list), 1)
order_movement = order_movement_list[0]
self.failUnless(order_movement is not None)
self.failUnless(order_movement.getRelativeUrl().\
startswith(order_relative_url))
rule_list = simulation_movement.objectValues()
self.failUnless(len(rule_list), 1)
delivering_rule = rule_list[0]
self.failUnless(delivering_rule.getSpecialiseValue().getPortalType(),
'Delivering Rule')
child_simulation_movement_list = delivering_rule.objectValues()
self.failUnless(len(child_simulation_movement_list), 1)
packing_list_movement_list = child_simulation_movement_list[0].getDeliveryValueList()
self.failUnless(len(packing_list_movement_list), 1)
packing_list_movement = packing_list_movement_list[0]
self.failUnless(packing_list_movement is not None)
......
......@@ -490,12 +490,23 @@ class TestPackingListMixin(TestOrderMixin):
applied_rule = sequence.get('applied_rule')
simulation_movement_list = applied_rule.objectValues()
self.assertEquals(len(simulation_movement_list),1)
order_line = sequence.get('order_line')
packing_list = sequence.get('packing_list')
packing_list_line = sequence.get('packing_list_line')
for simulation_movement in simulation_movement_list:
self.assertEquals(simulation_movement.getDeliveryValue(),packing_list_line)
self.assertEquals(simulation_movement.getDeliveryValue(), order_line)
self.assertEquals(packing_list_line.getCausalityValue(),
simulation_movement.getOrderValue())
order_line)
rule_list = simulation_movement.objectValues()
self.failUnless(len(rule_list), 1)
delivering_rule = rule_list[0]
self.failUnless(delivering_rule.getSpecialiseValue().getPortalType(),
'Delivering Rule')
child_simulation_movement_list = delivering_rule.objectValues()
self.failUnless(len(child_simulation_movement_list), 1)
child_simulation_movement = child_simulation_movement_list[0]
self.assertEquals(child_simulation_movement.getDeliveryValue(),
packing_list_line)
def stepCheckSimulationDisconnected(self,sequence=None, sequence_list=None, **kw):
"""
......@@ -505,7 +516,8 @@ class TestPackingListMixin(TestOrderMixin):
simulation_movement_list = applied_rule.objectValues()
self.assertEquals(len(simulation_movement_list),1)
for simulation_movement in simulation_movement_list:
self.assertEquals(simulation_movement.getDeliveryValue(),None)
child_simulation_movement = simulation_movement.objectValues()[0].objectValues()[0]
self.assertEquals(child_simulation_movement.getDeliveryValue(),None)
def stepModifySimulationLineQuantity(self,sequence=None, sequence_list=None, **kw):
"""
......@@ -516,7 +528,8 @@ class TestPackingListMixin(TestOrderMixin):
# self.assertEquals(len(simulation_movement_list),1)
for simulation_movement in simulation_movement_list:
simulation_movement.edit(quantity=self.default_quantity-1)
simulation_movement.getOrderValue().edit(quantity=self.default_quantity-1)
simulation_movement.getDeliveryValue().edit(quantity=self.default_quantity-1)
simulation_movement.expand()
def stepModifySimulationLineQuantityForMergedLine(self,sequence=None, sequence_list=None, **kw):
"""
......@@ -527,7 +540,8 @@ class TestPackingListMixin(TestOrderMixin):
self.assertEquals(len(simulation_movement_list),2)
for simulation_movement in simulation_movement_list:
simulation_movement.edit(quantity=self.default_quantity-1)
simulation_movement.getOrderValue().edit(quantity=self.default_quantity-1)
simulation_movement.getDeliveryValue().edit(quantity=self.default_quantity-1)
simulation_movement.expand()
def stepModifySimulationLineStartDate(self,sequence=None, sequence_list=None, **kw):
"""
......@@ -539,6 +553,7 @@ class TestPackingListMixin(TestOrderMixin):
for simulation_movement in simulation_movement_list:
simulation_movement.recordProperty('start_date')
simulation_movement.edit(start_date=self.datetime+15)
simulation_movement.expand()
def stepModifyOneSimulationLineStartDate(self,sequence=None, sequence_list=None, **kw):
"""
......@@ -550,6 +565,7 @@ class TestPackingListMixin(TestOrderMixin):
self.assertEquals(len(simulation_movement_list),len(resource_list))
simulation_movement_list[-1].recordProperty('start_date')
simulation_movement_list[-1].edit(start_date=self.datetime+15)
simulation_movement_list[-1].expand()
def stepModifySimulationLineResource(self,sequence=None, sequence_list=None, **kw):
"""
......@@ -561,6 +577,7 @@ class TestPackingListMixin(TestOrderMixin):
for simulation_movement in simulation_movement_list:
simulation_movement.recordProperty('resource')
simulation_movement.edit(resource_value=resource_list[-1])
simulation_movement.expand()
def stepModifyOneSimulationLineResource(self,sequence=None, sequence_list=None, **kw):
"""
......@@ -571,6 +588,7 @@ class TestPackingListMixin(TestOrderMixin):
resource_list = sequence.get('resource_list')
simulation_movement_list[-1].recordProperty('resource')
simulation_movement_list[-1].edit(resource_value=resource_list[-1])
simulation_movement_list[-1].expand()
def stepNewPackingListAdoptPrevisionQuantity(self,sequence=None, sequence_list=None, **kw):
"""
......@@ -669,14 +687,16 @@ class TestPackingListMixin(TestOrderMixin):
self.assertEquals(packing_list_line.getQuantity(), self.default_quantity)
self.assertNotEquals(packing_list_line.getResourceValue(), new_resource)
simulation_movement_list = packing_list_line.getDeliveryRelatedValueList()
order_line_list = [x.getOrder() for x in simulation_movement_list]
order_line_list = [x.getParentValue().getParentValue().getDelivery() \
for x in simulation_movement_list]
self.assertEquals(sorted(packing_list_line.getCausalityList()),
sorted(order_line_list))
new_packing_list_line = packing_list_line.aq_parent[str(int(packing_list_line.getId())+1)]
self.assertEquals(new_packing_list_line.getQuantity(), self.default_quantity)
self.assertEquals(new_packing_list_line.getResourceValue(), new_resource)
simulation_movement_list = new_packing_list_line.getDeliveryRelatedValueList()
order_line_list = [x.getOrder() for x in simulation_movement_list]
order_line_list = [x.getParentValue().getParentValue().getDelivery() \
for x in simulation_movement_list]
self.assertEquals(sorted(new_packing_list_line.getCausalityList()),
sorted(order_line_list))
......@@ -695,7 +715,8 @@ class TestPackingListMixin(TestOrderMixin):
self.assertEquals(packing_list_line.getQuantity(), self.default_quantity * 2)
self.assertEquals(packing_list_line.getResourceValue(), resource)
simulation_movement_list = packing_list_line.getDeliveryRelatedValueList()
order_line_list = [x.getOrder() for x in simulation_movement_list]
order_line_list = [x.getParentValue().getParentValue().getDelivery() \
for x in simulation_movement_list]
self.assertEquals(sorted(packing_list_line.getCausalityList()),
sorted(order_line_list))
......
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