Commit 621a33e6 authored by Alexandre Boeglin's avatar Alexandre Boeglin

various small changes and fixes

- renamed some variables
- fixed wrong docstrings
- renamed steps in sequences to allow fast lookup in vim using '*'


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7288 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4316e8b4
...@@ -59,70 +59,70 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -59,70 +59,70 @@ class TestPackingListMixin(TestOrderMixin):
""" """
Test business template erp5_trade Test business template erp5_trade
""" """
container_type = 'Container' container_portal_type = 'Container'
container_line_type = 'Container Line' container_line_portal_type = 'Container Line'
container_cell_type = 'Container Cell' container_cell_portal_type = 'Container Cell'
default_sequence = 'CreateOrganisation1 \ default_sequence = 'stepCreateOrganisation1 \
CreateOrganisation2 \ stepCreateOrganisation2 \
CreateOrganisation3 \ stepCreateOrganisation3 \
CreateOrder \ stepCreateOrder \
SetOrderProfile \ stepSetOrderProfile \
CreateNotVariatedResource \ stepCreateNotVariatedResource \
Tic \ stepTic \
CreateOrderLine \ stepCreateOrderLine \
SetOrderLineResource \ stepSetOrderLineResource \
SetOrderLineDefaultValues \ stepSetOrderLineDefaultValues \
OrderOrder \ stepOrderOrder \
Tic \ stepTic \
ConfirmOrder \ stepConfirmOrder \
Tic \ stepTic \
CheckOrderSimulation \ stepCheckOrderSimulation \
CheckDeliveryBuilding \ stepCheckDeliveryBuilding \
CheckPackingListIsNotDivergent ' stepCheckPackingListIsNotDivergent '
default_sequence_with_two_lines = 'CreateOrganisation1 \ default_sequence_with_two_lines = 'stepCreateOrganisation1 \
CreateOrganisation2 \ stepCreateOrganisation2 \
CreateOrganisation3 \ stepCreateOrganisation3 \
CreateOrder \ stepCreateOrder \
SetOrderProfile \ stepSetOrderProfile \
CreateNotVariatedResource \ stepCreateNotVariatedResource \
Tic \ stepTic \
CreateOrderLine \ stepCreateOrderLine \
SetOrderLineResource \ stepSetOrderLineResource \
SetOrderLineDefaultValues \ stepSetOrderLineDefaultValues \
CreateNotVariatedResource \ stepCreateNotVariatedResource \
Tic \ stepTic \
CreateOrderLine \ stepCreateOrderLine \
SetOrderLineResource \ stepSetOrderLineResource \
SetOrderLineDefaultValues \ stepSetOrderLineDefaultValues \
OrderOrder \ stepOrderOrder \
Tic \ stepTic \
ConfirmOrder \ stepConfirmOrder \
Tic \ stepTic \
CheckOrderSimulation \ stepCheckOrderSimulation \
CheckDeliveryBuilding \ stepCheckDeliveryBuilding \
CheckPackingListIsNotDivergent ' stepCheckPackingListIsNotDivergent '
variated_default_sequence = 'CreateOrganisation1 \ variated_default_sequence = 'stepCreateOrganisation1 \
CreateOrganisation2 \ stepCreateOrganisation2 \
CreateOrganisation3 \ stepCreateOrganisation3 \
CreateOrder \ stepCreateOrder \
SetOrderProfile \ stepSetOrderProfile \
CreateVariatedResource \ stepCreateVariatedResource \
Tic \ stepTic \
CreateOrderLine \ stepCreateOrderLine \
SetOrderLineResource \ stepSetOrderLineResource \
SetOrderLineDefaultValues \ stepSetOrderLineDefaultValues \
SetOrderLineFullVCL \ stepSetOrderLineFullVCL \
CompleteOrderLineMatrix \ stepCompleteOrderLineMatrix \
OrderOrder \ stepOrderOrder \
Tic \ stepTic \
ConfirmOrder \ stepConfirmOrder \
Tic \ stepTic \
CheckOrderSimulation \ stepCheckOrderSimulation \
CheckDeliveryBuilding \ stepCheckDeliveryBuilding \
CheckPackingListIsNotDivergent ' stepCheckPackingListIsNotDivergent '
def getTitle(self): def getTitle(self):
return "Packing List" return "Packing List"
...@@ -148,27 +148,27 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -148,27 +148,27 @@ class TestPackingListMixin(TestOrderMixin):
""" """
if packing_list is None: if packing_list is None:
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
self.failUnless('Site Error' not in packing_list.view()) self.failIf('Site Error' in packing_list.view())
self.assertEquals('diverged', packing_list.getCausalityState()) self.assertTrue(packing_list.isDivergent())
def stepCheckNewPackingListIsDivergent(self, sequence=None, sequence_list=None, **kw): def stepCheckNewPackingListIsDivergent(self, sequence=None, sequence_list=None, **kw):
""" """
Test if packing list is divergent Test if packing list is divergent
""" """
packing_list = sequence.get('new_packing_list') packing_list = sequence.get('new_packing_list')
self.failUnless('Site Error' not in packing_list.view()) self.failIf('Site Error' in packing_list.view())
self.stepCheckPackingListIsDivergent(packing_list=packing_list,sequence=sequence) self.stepCheckPackingListIsDivergent(packing_list=packing_list,sequence=sequence)
def stepCheckPackingListIsCalculating(self, sequence=None, sequence_list=None, **kw): def stepCheckPackingListIsCalculating(self, sequence=None, sequence_list=None, **kw):
""" """
Test if packing list is divergent Test if packing list is calculating
""" """
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
self.assertEquals('calculating',packing_list.getCausalityState()) self.assertEquals('calculating',packing_list.getCausalityState())
def stepCheckPackingListIsSolved(self, sequence=None, sequence_list=None, **kw): def stepCheckPackingListIsSolved(self, sequence=None, sequence_list=None, **kw):
""" """
Test if packing list is divergent Test if packing list is solved
""" """
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
self.assertEquals('solved',packing_list.getCausalityState()) self.assertEquals('solved',packing_list.getCausalityState())
...@@ -185,7 +185,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -185,7 +185,7 @@ class TestPackingListMixin(TestOrderMixin):
Test if packing list is not divergent Test if packing list is not divergent
""" """
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
self.assertEquals(False,packing_list.isDivergent()) self.assertFalse(packing_list.isDivergent())
def stepChangePackingListLineResource(self, sequence=None, def stepChangePackingListLineResource(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -198,9 +198,10 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -198,9 +198,10 @@ class TestPackingListMixin(TestOrderMixin):
portal_type=self.packing_list_line_portal_type): portal_type=self.packing_list_line_portal_type):
packing_list_line.edit(resource_value=resource) packing_list_line.edit(resource_value=resource)
def stepDecreasePackingListLineQuantity(self, sequence=None, sequence_list=None, **kw): def stepDecreasePackingListLineQuantity(self, sequence=None,
sequence_list=None, **kw):
""" """
Test if packing list is divergent Set a decreased quantity on packing list lines
""" """
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
quantity = sequence.get('line_quantity',default=self.default_quantity) quantity = sequence.get('line_quantity',default=self.default_quantity)
...@@ -210,9 +211,10 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -210,9 +211,10 @@ class TestPackingListMixin(TestOrderMixin):
portal_type=self.packing_list_line_portal_type): portal_type=self.packing_list_line_portal_type):
packing_list_line.edit(quantity=quantity) packing_list_line.edit(quantity=quantity)
def stepIncreasePackingListLineQuantity(self, sequence=None, sequence_list=None, **kw): def stepIncreasePackingListLineQuantity(self, sequence=None,
sequence_list=None, **kw):
""" """
Test if packing list is divergent Set a increased quantity on packing list lines
""" """
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
for packing_list_line in packing_list.objectValues( for packing_list_line in packing_list.objectValues(
...@@ -231,7 +233,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -231,7 +233,7 @@ class TestPackingListMixin(TestOrderMixin):
def stepCheckPackingListSplitted(self, sequence=None, sequence_list=None, **kw): def stepCheckPackingListSplitted(self, sequence=None, sequence_list=None, **kw):
""" """
Test if packing list is divergent Test if packing list was splitted
""" """
order = sequence.get('order') order = sequence.get('order')
packing_list_list = order.getCausalityRelatedValueList( packing_list_list = order.getCausalityRelatedValueList(
...@@ -472,7 +474,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -472,7 +474,7 @@ class TestPackingListMixin(TestOrderMixin):
""" """
if packing_list is None: if packing_list is None:
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
container = packing_list.newContent(portal_type=self.container_type) container = packing_list.newContent(portal_type=self.container_portal_type)
sequence.edit(container=container) sequence.edit(container=container)
def stepDefineNewPackingListContainer(self,sequence=None, sequence_list=None, **kw): def stepDefineNewPackingListContainer(self,sequence=None, sequence_list=None, **kw):
...@@ -489,7 +491,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -489,7 +491,7 @@ class TestPackingListMixin(TestOrderMixin):
Check if simulation movement are disconnected Check if simulation movement are disconnected
""" """
container = sequence.get('container') container = sequence.get('container')
container_line = container.newContent(portal_type=self.container_line_type) container_line = container.newContent(portal_type=self.container_line_portal_type)
sequence.edit(container_line=container_line) sequence.edit(container_line=container_line)
resource = sequence.get('resource') resource = sequence.get('resource')
container_line.edit(resource_value=resource) container_line.edit(resource_value=resource)
...@@ -526,7 +528,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -526,7 +528,7 @@ class TestPackingListMixin(TestOrderMixin):
resource = line.getResourceValue() resource = line.getResourceValue()
tmp_kw={'movement.resource_uid':resource.getUid()} tmp_kw={'movement.resource_uid':resource.getUid()}
container_line = \ container_line = \
container.newContent(portal_type=self.container_line_type) container.newContent(portal_type=self.container_line_portal_type)
container_line.setResourceValue(resource) container_line.setResourceValue(resource)
# without variation # without variation
if not line.hasCellContent(): if not line.hasCellContent():
...@@ -545,7 +547,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -545,7 +547,7 @@ class TestPackingListMixin(TestOrderMixin):
if line.hasCell(base_id=base_id, *cell_key): if line.hasCell(base_id=base_id, *cell_key):
old_cell = line.getCell(base_id=base_id, *cell_key) old_cell = line.getCell(base_id=base_id, *cell_key)
cell = container_line.newCell(base_id=base_id, cell = container_line.newCell(base_id=base_id,
portal_type=self.container_cell_type, *cell_key) portal_type=self.container_cell_portal_type, *cell_key)
cell.edit(mapped_value_property_list=['price', 'quantity'], cell.edit(mapped_value_property_list=['price', 'quantity'],
price=old_cell.getPrice(), price=old_cell.getPrice(),
quantity=old_cell.getQuantity(), quantity=old_cell.getQuantity(),
...@@ -598,12 +600,12 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -598,12 +600,12 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence + '\ sequence_string = self.default_sequence + '\
DecreasePackingListLineQuantity \ stepDecreasePackingListLineQuantity \
CheckPackingListIsCalculating \ stepCheckPackingListIsCalculating \
SplitAndDeferPackingList \ stepSplitAndDeferPackingList \
Tic \ stepTic \
CheckPackingListIsSolved \ stepCheckPackingListIsSolved \
CheckPackingListSplitted \ stepCheckPackingListSplitted \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -618,10 +620,10 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -618,10 +620,10 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence + '\ sequence_string = self.default_sequence + '\
ChangePackingListDestination \ stepChangePackingListDestination \
CheckPackingListIsDivergent \ stepCheckPackingListIsDivergent \
Tic \ stepTic \
CheckSimulationDestinationUpdated \ stepCheckSimulationDestinationUpdated \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -636,13 +638,13 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -636,13 +638,13 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence + '\ sequence_string = self.default_sequence + '\
ChangePackingListStartDate \ stepChangePackingListStartDate \
CheckPackingListIsCalculating \ stepCheckPackingListIsCalculating \
AcceptDecision \ stepAcceptDecision \
Tic \ stepTic \
CheckPackingListIsSolved \ stepCheckPackingListIsSolved \
CheckPackingListIsNotDivergent \ stepCheckPackingListIsNotDivergent \
CheckSimulationStartDateUpdated \ stepCheckSimulationStartDateUpdated \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -657,11 +659,11 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -657,11 +659,11 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence + '\ sequence_string = self.default_sequence + '\
CheckSimulationConnected \ stepCheckSimulationConnected \
DeletePackingListLine \ stepDeletePackingListLine \
CheckPackingListIsNotDivergent \ stepCheckPackingListIsNotDivergent \
Tic \ stepTic \
CheckSimulationDisconnected \ stepCheckSimulationDisconnected \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -676,14 +678,14 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -676,14 +678,14 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence + '\ sequence_string = self.default_sequence + '\
ModifySimulationLineQuantity \ stepModifySimulationLineQuantity \
Tic \ stepTic \
CheckPackingListIsDiverged \ stepCheckPackingListIsDiverged \
AdoptPrevision \ stepAdoptPrevision \
Tic \ stepTic \
CheckPackingListIsNotDivergent \ stepCheckPackingListIsNotDivergent \
CheckPackingListIsSolved \ stepCheckPackingListIsSolved \
CheckPackingListLineWithNewQuantityPrevision \ stepCheckPackingListLineWithNewQuantityPrevision \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -698,13 +700,13 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -698,13 +700,13 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence + '\ sequence_string = self.default_sequence + '\
ModifySimulationLineStartDate \ stepModifySimulationLineStartDate \
Tic \ stepTic \
CheckPackingListIsDiverged \ stepCheckPackingListIsDiverged \
AdoptPrevision \ stepAdoptPrevision \
Tic \ stepTic \
CheckPackingListIsSolved \ stepCheckPackingListIsSolved \
CheckNewPackingListAfterStartDateAdopt \ stepCheckNewPackingListAfterStartDateAdopt \
' '
# XXX Check if there is a new packing list created # XXX Check if there is a new packing list created
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -720,15 +722,15 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -720,15 +722,15 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence_with_two_lines + '\ sequence_string = self.default_sequence_with_two_lines + '\
ModifySimulationLineStartDate \ stepModifySimulationLineStartDate \
Tic \ stepTic \
CheckPackingListIsDiverged \ stepCheckPackingListIsDiverged \
CheckPackingListIsDivergent \ stepCheckPackingListIsDivergent \
AdoptPrevision \ stepAdoptPrevision \
Tic \ stepTic \
CheckPackingListIsNotDivergent \ stepCheckPackingListIsNotDivergent \
CheckPackingListIsSolved \ stepCheckPackingListIsSolved \
CheckNewPackingListAfterStartDateAdopt \ stepCheckNewPackingListAfterStartDateAdopt \
' '
# XXX Check if there is a new packing list created # XXX Check if there is a new packing list created
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -744,13 +746,13 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -744,13 +746,13 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence + '\ sequence_string = self.default_sequence + '\
AddPackingListContainer \ stepAddPackingListContainer \
AddPackingListContainerLine \ stepAddPackingListContainerLine \
SetContainerLineSmallQuantity \ stepSetContainerLineSmallQuantity \
CheckPackingListIsNotPacked \ stepCheckPackingListIsNotPacked \
SetContainerFullQuantity \ stepSetContainerFullQuantity \
Tic \ stepTic \
CheckPackingListIsPacked \ stepCheckPackingListIsPacked \
' '
# XXX Check if there is a new packing list created # XXX Check if there is a new packing list created
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -766,13 +768,13 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -766,13 +768,13 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a order with cells # Test with a order with cells
sequence_string = self.variated_default_sequence + '\ sequence_string = self.variated_default_sequence + '\
AddPackingListContainer \ stepAddPackingListContainer \
AddPackingListContainerLine \ stepAddPackingListContainerLine \
SetContainerLineSmallQuantity \ stepSetContainerLineSmallQuantity \
CheckPackingListIsNotPacked \ stepCheckPackingListIsNotPacked \
SetContainerFullQuantity \ stepSetContainerFullQuantity \
Tic \ stepTic \
CheckPackingListIsPacked \ stepCheckPackingListIsPacked \
' '
# XXX Check if there is a new packing list created # XXX Check if there is a new packing list created
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -790,12 +792,12 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -790,12 +792,12 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence + '\ sequence_string = self.default_sequence + '\
IncreasePackingListLineQuantity \ stepIncreasePackingListLineQuantity \
CheckPackingListIsCalculating \ stepCheckPackingListIsCalculating \
SplitAndDeferPackingList \ stepSplitAndDeferPackingList \
Tic \ stepTic \
CheckPackingListIsSolved \ stepCheckPackingListIsSolved \
CheckPackingListNotSplitted \ stepCheckPackingListNotSplitted \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -813,21 +815,21 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -813,21 +815,21 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence + '\ sequence_string = self.default_sequence + '\
DecreasePackingListLineQuantity \ stepDecreasePackingListLineQuantity \
CheckPackingListIsCalculating \ stepCheckPackingListIsCalculating \
SplitAndDeferPackingList \ stepSplitAndDeferPackingList \
Tic \ stepTic \
CheckPackingListIsSolved \ stepCheckPackingListIsSolved \
CheckPackingListSplitted \ stepCheckPackingListSplitted \
DecreasePackingListLineQuantity \ stepDecreasePackingListLineQuantity \
CheckPackingListIsCalculating \ stepCheckPackingListIsCalculating \
SplitAndDeferPackingList \ stepSplitAndDeferPackingList \
Tic \ stepTic \
CheckNewPackingListIsDivergent \ stepCheckNewPackingListIsDivergent \
NewPackingListAdoptPrevision \ stepNewPackingListAdoptPrevision \
Tic \ stepTic \
CheckPackingListIsSolved \ stepCheckPackingListIsSolved \
CheckPackingListSplittedTwoTimes \ stepCheckPackingListSplittedTwoTimes \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -842,11 +844,11 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -842,11 +844,11 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = self.default_sequence + '\ sequence_string = self.default_sequence + '\
CreateNotVariatedResource \ stepCreateNotVariatedResource \
ChangePackingListLineResource \ stepChangePackingListLineResource \
CheckPackingListIsCalculating \ stepCheckPackingListIsCalculating \
Tic \ stepTic \
CheckPackingListIsDivergent \ stepCheckPackingListIsDivergent \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
......
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