Commit 79417297 authored by Romain Courteaud's avatar Romain Courteaud

Bug fix: DeliveryBuilder test is now working.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2918 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 766c5e66
...@@ -72,6 +72,7 @@ class TestOrder(ERP5TypeTestCase): ...@@ -72,6 +72,7 @@ class TestOrder(ERP5TypeTestCase):
packing_list_portal_type = 'Sale Packing List' packing_list_portal_type = 'Sale Packing List'
packing_list_line_portal_type = 'Sale Packing List Line' packing_list_line_portal_type = 'Sale Packing List Line'
packing_list_cell_portal_type = 'Delivery Cell' packing_list_cell_portal_type = 'Delivery Cell'
delivery_builder_id = 'sale_packing_list_builder'
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
""" """
...@@ -1356,6 +1357,43 @@ class TestOrder(ERP5TypeTestCase): ...@@ -1356,6 +1357,43 @@ class TestOrder(ERP5TypeTestCase):
# if not run: return # if not run: return
# self.failUnless(1==2) # self.failUnless(1==2)
def stepCheckDeliveryBuilderPresence(self, sequence=None,
sequence_list=None, **kw):
"""
Test if delivery builder exists
"""
delivery_builder = getattr(self.getPortal().portal_deliveries,
self.delivery_builder_id)
self.assertEquals('Delivery Builder', delivery_builder.getPortalType())
def stepCreateOrganisation1(self,sequence=None, sequence_list=None, **kw):
"""
Create a empty organisation
"""
self.stepCreateOrganisation(sequence=sequence, sequence_list=sequence_list,
**kw)
organisation = sequence.get('organisation')
sequence.edit(organisation1=organisation)
def stepCreateOrganisation2(self,sequence=None, sequence_list=None, **kw):
"""
Create a empty organisation
"""
self.stepCreateOrganisation(sequence=sequence, sequence_list=sequence_list,
**kw)
organisation = sequence.get('organisation')
sequence.edit(organisation2=organisation)
def stepSetOrderProfile(self,sequence=None, sequence_list=None, **kw):
"""
Set different source and destination on the order
"""
organisation1 = sequence.get('organisation1')
organisation2 = sequence.get('organisation2')
order = sequence.get('order')
order.setSourceValue(organisation1)
order.setDestinationValue(organisation2)
def stepCheckDeliveryBuilding(self, sequence=None, sequence_list=None, **kw): def stepCheckDeliveryBuilding(self, sequence=None, sequence_list=None, **kw):
""" """
Test if packing list is well created. Test if packing list is well created.
...@@ -1393,10 +1431,11 @@ class TestOrder(ERP5TypeTestCase): ...@@ -1393,10 +1431,11 @@ class TestOrder(ERP5TypeTestCase):
# Then, test if each packing list movement is equals to the sum of somes # Then, test if each packing list movement is equals to the sum of somes
# Simulation Movement # Simulation Movement
packing_list_movement_list = [] packing_list_movement_list = []
for packing_list_line in packing_list.objectValues( for packing_list_line in packing_list.searchFolder(
portal_type=packing_list_line_portal_type): portal_type=self.packing_list_line_portal_type):
cell_list = packing_list_line.objectValues( packing_list_line = packing_list_line.getObject()
portal_type=packing_list_cell_portal_type) cell_list = [x.getObject() for x in packing_list_line.searchFolder(
portal_type=self.packing_list_cell_portal_type)]
if len(cell_list) == 0: if len(cell_list) == 0:
packing_list_movement_list.append(packing_list_line) packing_list_movement_list.append(packing_list_line)
else: else:
...@@ -1409,8 +1448,8 @@ class TestOrder(ERP5TypeTestCase): ...@@ -1409,8 +1448,8 @@ class TestOrder(ERP5TypeTestCase):
for related_simulation_movement in related_simulation_movement_list: for related_simulation_movement in related_simulation_movement_list:
quantity += related_simulation_movement.getQuantity() quantity += related_simulation_movement.getQuantity()
# Test price # Test price
self.assertEquals(order_movement.getPrice(), \ self.assertEquals(packing_list_movement.getPrice(), \
simulation_movement.getPrice()) related_simulation_movement.getPrice())
# Test resource # Test resource
self.assertEquals(packing_list_movement.getResource(), \ self.assertEquals(packing_list_movement.getResource(), \
related_simulation_movement.getResource()) related_simulation_movement.getResource())
...@@ -1434,10 +1473,18 @@ class TestOrder(ERP5TypeTestCase): ...@@ -1434,10 +1473,18 @@ class TestOrder(ERP5TypeTestCase):
""" """
if not run: return if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# First, test if delivery buider exists
sequence_string = '\
CheckDeliveryBuilderPresence \
'
sequence_list.addSequenceString(sequence_string)
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = '\ sequence_string = '\
CreateOrganisation \ CreateOrganisation1 \
CreateOrganisation2 \
CreateOrder \ CreateOrder \
SetOrderProfile \
CreateNotVariatedResource \ CreateNotVariatedResource \
Tic \ Tic \
CreateOrderLine \ CreateOrderLine \
...@@ -1454,8 +1501,10 @@ class TestOrder(ERP5TypeTestCase): ...@@ -1454,8 +1501,10 @@ class TestOrder(ERP5TypeTestCase):
# Test to confirm order with variated resource # Test to confirm order with variated resource
sequence_string = '\ sequence_string = '\
CreateOrganisation \ CreateOrganisation1 \
CreateOrganisation2 \
CreateOrder \ CreateOrder \
SetOrderProfile \
CreateVariatedResource \ CreateVariatedResource \
Tic \ Tic \
CreateOrderLine \ CreateOrderLine \
...@@ -1475,8 +1524,10 @@ class TestOrder(ERP5TypeTestCase): ...@@ -1475,8 +1524,10 @@ class TestOrder(ERP5TypeTestCase):
# Test to confirm order with multiples lines # Test to confirm order with multiples lines
sequence_string = '\ sequence_string = '\
CreateOrganisation \ CreateOrganisation1 \
CreateOrganisation2 \
CreateOrder \ CreateOrder \
SetOrderProfile \
CreateVariatedResource \ CreateVariatedResource \
Tic \ Tic \
CreateOrderLine \ CreateOrderLine \
...@@ -1499,6 +1550,29 @@ class TestOrder(ERP5TypeTestCase): ...@@ -1499,6 +1550,29 @@ class TestOrder(ERP5TypeTestCase):
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
# Test with a order with 2 lines and the same not variated resource
sequence_string = '\
CreateOrganisation1 \
CreateOrganisation2 \
CreateOrder \
SetOrderProfile \
CreateNotVariatedResource \
Tic \
CreateOrderLine \
SetOrderLineResource \
SetOrderLineDefaultValues \
CreateOrderLine \
SetOrderLineResource \
SetOrderLineDefaultValues \
OrderOrder \
Tic \
CheckDeliveryBuilding \
ConfirmOrder \
Tic \
CheckDeliveryBuilding \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
# XXX # XXX
......
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