From 11dcdb98100c926772ada650efe8e2655d7831e6 Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Wed, 1 Sep 2010 17:54:58 +0000
Subject: [PATCH] testPackingList: remove useless method

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@38112 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testInvoice.py     |  4 ++--
 product/ERP5/tests/testPackingList.py | 26 ++++++--------------------
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/product/ERP5/tests/testInvoice.py b/product/ERP5/tests/testInvoice.py
index 4a8b67e053..c29480869b 100644
--- a/product/ERP5/tests/testInvoice.py
+++ b/product/ERP5/tests/testInvoice.py
@@ -963,8 +963,8 @@ class TestInvoiceMixin(TestPackingListMixin,
   def stepUnifyStartDateWithDecisionInvoice(self, sequence=None,
                                             sequence_list=None):
     invoice = sequence.get('invoice')
-    self._solveDeliveryGroupDivergence(invoice, 'start_date',
-       'Unify Solver', value=invoice.getStartDate())
+    self._solveDivergence(invoice, 'start_date', 'Unify Solver',
+                          value=invoice.getStartDate())
 
   def stepAcceptDecisionQuantityInvoice(self,sequence=None, sequence_list=None):
     invoice = sequence.get('invoice')
diff --git a/product/ERP5/tests/testPackingList.py b/product/ERP5/tests/testPackingList.py
index dfc561423f..44189520f2 100644
--- a/product/ERP5/tests/testPackingList.py
+++ b/product/ERP5/tests/testPackingList.py
@@ -651,16 +651,15 @@ class TestPackingListMixin(TestOrderMixin):
       Check if simulation movement are disconnected
     """
     packing_list = sequence.get('packing_list')
-    self._solveDeliveryGroupDivergence(packing_list, 'destination',
-                                       'Accept Solver')
+    self._solveDivergence(packing_list, 'destination', 'Accept Solver')
 
   def stepUnifyStartDateWithDecision(self,sequence=None, sequence_list=None, **kw):
     """
       Check if simulation movement are disconnected
     """
     packing_list = sequence.get('packing_list')
-    self._solveDeliveryGroupDivergence(packing_list, 'start_date',
-       'Unify Solver', value=packing_list.getStartDate())
+    self._solveDivergence(packing_list, 'start_date', 'Unify Solver',
+                          value=packing_list.getStartDate())
 
   def stepUnifyStopDateWithDecision(self,sequence=None, sequence_list=None, **kw):
     """
@@ -675,7 +674,7 @@ class TestPackingListMixin(TestOrderMixin):
     packing_list = sequence.get('packing_list')
     applied_rule = sequence.get('applied_rule')
     simulation_movement_list = applied_rule.objectValues()
-    self._solveDeliveryGroupDivergence(packing_list, 'start_date',
+    self._solveDivergence(packing_list, 'start_date',
       'Unify Solver', value=simulation_movement_list[-1].getStartDate())
 
   def stepUnifyStopDateWithPrevision(self,sequence=None, sequence_list=None, **kw):
@@ -684,19 +683,6 @@ class TestPackingListMixin(TestOrderMixin):
     """
     raise NotImplementedError
 
-  def _solveDeliveryGroupDivergence(self, document, property, solver, **kw):
-    solver_process_tool = self.portal.portal_solver_processes
-    solver_process = solver_process_tool.newSolverProcess(document)
-    for solver_decision in solver_process.contentValues():
-      if solver_decision.getCausalityValue().getTestedProperty() == property:
-        # use Quantity Accept Solver.
-        solver_decision.setSolverValue(self.portal.portal_solvers[solver])
-        # configure for Accept Solver.
-        solver_decision.updateConfiguration(tested_property_list=[property],
-                                            **kw)
-    solver_process.buildTargetSolverList()
-    solver_process.solve()
-
   def stepAcceptDecisionResource(self,sequence=None, sequence_list=None, **kw):
     packing_list = sequence.get('packing_list')
     self._solveDivergence(packing_list, 'resource', 'Accept Solver')
@@ -713,7 +699,7 @@ class TestPackingListMixin(TestOrderMixin):
     packing_list = sequence.get('packing_list')
     self._solveDivergence(packing_list, 'quantity', 'Adopt Solver')
 
-  def _solveDivergence(self, document, property, solver):
+  def _solveDivergence(self, document, property, solver, **kw):
     """Solve divergence by using solver tool"""
     solver_process_tool = self.portal.portal_solver_processes
     solver_process = solver_process_tool.newSolverProcess(document)
@@ -722,7 +708,7 @@ class TestPackingListMixin(TestOrderMixin):
     # use Quantity Accept Solver.
     solver_decision.setSolverValue(self.portal.portal_solvers[solver])
     # configure for Accept Solver.
-    solver_decision.updateConfiguration(tested_property_list=[property])
+    solver_decision.updateConfiguration(tested_property_list=[property], **kw)
     solver_process.buildTargetSolverList()
     solver_process.solve()
 
-- 
2.30.9