Commit a5b99efb authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

add assertions to check solver's state.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31406 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d4120eb3
...@@ -121,6 +121,7 @@ class TestERP5Simulation(TestERP5SimulationMixin, ERP5TypeTestCase): ...@@ -121,6 +121,7 @@ class TestERP5Simulation(TestERP5SimulationMixin, ERP5TypeTestCase):
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
solver_tool = self.portal.portal_solvers solver_tool = self.portal.portal_solvers
solver_process = solver_tool.newSolverProcess(packing_list) solver_process = solver_tool.newSolverProcess(packing_list)
sequence.edit(solver_process=solver_process)
quantity_solver_decision = filter( quantity_solver_decision = filter(
lambda x:x.getCausalityValue().getTestedProperty()=='converted_quantity', lambda x:x.getCausalityValue().getTestedProperty()=='converted_quantity',
solver_process.contentValues())[0] solver_process.contentValues())[0]
...@@ -170,6 +171,28 @@ class TestERP5Simulation(TestERP5SimulationMixin, ERP5TypeTestCase): ...@@ -170,6 +171,28 @@ class TestERP5Simulation(TestERP5SimulationMixin, ERP5TypeTestCase):
portal_type= self.packing_list_line_portal_type): portal_type= self.packing_list_line_portal_type):
self.assertEquals(10,line.getQuantity()) self.assertEquals(10,line.getQuantity())
def _checkSolverState(self, sequence=None, sequence_list=None,
state='solved'):
"""
Check if target solvers' state.
"""
solver_process = sequence.get('solver_process')
for solver in solver_process.objectValues(
portal_type=self.portal.getPortalTargetSolverTypeList()):
self.assertEquals(state, solver.getSolverState())
def stepCheckSolverIsSolving(self, sequence=None, sequence_list=None, **kw):
"""
Check if all target solvers have 'solving' state.
"""
self._checkSolverState(sequence, sequence_list, 'solving')
def stepCheckSolverIsSolved(self, sequence=None, sequence_list=None, **kw):
"""
Check if all target solvers have 'solved' state.
"""
self._checkSolverState(sequence, sequence_list, 'solved')
def test_01_splitAndDefer(self, quiet=quiet, run=run_all_test): def test_01_splitAndDefer(self, quiet=quiet, run=run_all_test):
""" """
Change the quantity on an delivery line, then Change the quantity on an delivery line, then
...@@ -196,9 +219,11 @@ class TestERP5Simulation(TestERP5SimulationMixin, ERP5TypeTestCase): ...@@ -196,9 +219,11 @@ class TestERP5Simulation(TestERP5SimulationMixin, ERP5TypeTestCase):
stepTic \ stepTic \
stepCheckPackingListIsDiverged \ stepCheckPackingListIsDiverged \
stepSplitAndDeferPackingList \ stepSplitAndDeferPackingList \
stepCheckSolverIsSolving \
stepTic \ stepTic \
stepCheckPackingListSplitted \ stepCheckPackingListSplitted \
stepCheckPackingListIsSolved \ stepCheckPackingListIsSolved \
stepCheckSolverIsSolved \
' '
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