Commit 80eba8a1 authored by Sebastien Robin's avatar Sebastien Robin

added test for containers


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3464 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ee2ccc6b
...@@ -60,6 +60,8 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -60,6 +60,8 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
Test business template erp5_trade Test business template erp5_trade
""" """
run_all_test = 1 run_all_test = 1
container_type = 'Container'
container_line_type = 'Container Line'
default_sequence = 'CreateOrganisation1 \ default_sequence = 'CreateOrganisation1 \
CreateOrganisation2 \ CreateOrganisation2 \
...@@ -278,6 +280,54 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -278,6 +280,54 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
new_packing_list = delivery_value.getParent() new_packing_list = delivery_value.getParent()
self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid()) self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid())
def stepAddPackingListContainer(self,sequence=None, sequence_list=None, **kw):
"""
Check if simulation movement are disconnected
"""
packing_list = sequence.get('packing_list')
container = packing_list.newContent(portal_type=self.container_type)
sequence.edit(container=container)
def stepAddPackingListContainerLine(self,sequence=None, sequence_list=None, **kw):
"""
Check if simulation movement are disconnected
"""
container = sequence.get('container')
container_line = container.newContent(portal_type=self.container_line_type)
sequence.edit(container_line=container_line)
resource = sequence.get('resource')
container_line.setResourceValue(resource)
def stepSetContainerLineSmallQuantity(self,sequence=None, sequence_list=None, **kw):
"""
Check if simulation movement are disconnected
"""
container_line = sequence.get('container_line')
container_line.edit(quantity=self.default_quantity-1)
def stepSetContainerLineFullQuantity(self,sequence=None, sequence_list=None, **kw):
"""
Check if simulation movement are disconnected
"""
container_line = sequence.get('container_line')
container_line.edit(quantity=self.default_quantity)
def stepCheckPackingListIsNotPacked(self,sequence=None, sequence_list=None, **kw):
"""
Check that the number of objects in containers are
not equals to the quantity of the packing list
"""
packing_list = sequence.get('packing_list')
self.assertEquals(0,packing_list.isPacked())
def stepCheckPackingListIsPacked(self,sequence=None, sequence_list=None, **kw):
"""
Check that the number of objects in containers are
equals to the quantity of the packing list
"""
packing_list = sequence.get('packing_list')
self.assertEquals(1,packing_list.isPacked())
def stepCommit(self, sequence=None, sequence_list=None, **kw): def stepCommit(self, sequence=None, sequence_list=None, **kw):
""" """
Commit transaction Commit transaction
...@@ -398,7 +448,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -398,7 +448,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
sequence_list.play(self) sequence_list.play(self)
def test_06_SimulationChangeStartDate(self, quiet=0, run=1): def test_07_SimulationChangeStartDate(self, quiet=0, run=run_all_test):
""" """
Test generation of delivery list Test generation of delivery list
""" """
...@@ -419,6 +469,29 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -419,6 +469,29 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
sequence_list.play(self) sequence_list.play(self)
def test_08_AddContainers(self, quiet=0, run=1):
"""
Test generation of delivery list
"""
if not run: return
sequence_list = SequenceList()
# Test with a simply order without cell
sequence_string = self.default_sequence + '\
AddPackingListContainer \
AddPackingListContainerLine \
SetContainerLineSmallQuantity \
CheckPackingListIsNotPacked \
SetContainerLineFullQuantity \
Tic \
CheckPackingListIsPacked \
'
#CheckNewPackingListAfterStartDateAdopt \
# XXX Check if there is a new packing list created
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
......
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