From 527a21394015ff47838a13fd128aaea2acee52b9 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Fri, 30 Apr 2010 09:08:11 +0000
Subject: [PATCH] change testTradeModelLine in order to use trade state
 categories instead of business states

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@34876 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testBPMCore.py        |  2 +-
 product/ERP5/tests/testTradeModelLine.py | 42 ++++--------------------
 2 files changed, 7 insertions(+), 37 deletions(-)

diff --git a/product/ERP5/tests/testBPMCore.py b/product/ERP5/tests/testBPMCore.py
index a53103a2f3..e394104adc 100644
--- a/product/ERP5/tests/testBPMCore.py
+++ b/product/ERP5/tests/testBPMCore.py
@@ -68,7 +68,7 @@ class TestBPMMixin(ERP5TypeTestCase):
     self.createCategoriesInCategory(category_tool.trade_phase.default,
         ['accounting', 'delivery', 'invoicing', 'discount', 'tax', 'payment'])
     self.createCategoriesInCategory(category_tool.trade_state,
-        ['ordered', 'invoiced', 'delivered',
+        ['ordered', 'invoiced', 'delivered', 'taxed',
          'state_a', 'state_b', 'state_c', 'state_d', 'state_e'])
 
   @reindex
diff --git a/product/ERP5/tests/testTradeModelLine.py b/product/ERP5/tests/testTradeModelLine.py
index 7f84fc0bae..a6b4c325da 100644
--- a/product/ERP5/tests/testTradeModelLine.py
+++ b/product/ERP5/tests/testTradeModelLine.py
@@ -101,10 +101,6 @@ class TestTradeModelLine(TestTradeModelLineMixin):
   AGGREGATED_AMOUNT_LIST_COMMON_SEQUENCE_STRING = \
       COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
               CreateBusinessProcess
-              CreateBusinessState
-              ModifyBusinessStateTaxed
-              CreateBusinessState
-              ModifyBusinessStateInvoiced
               CreateBusinessPath
               ModifyBusinessPathTaxing
               CreateBusinessPath
@@ -199,14 +195,10 @@ class TestTradeModelLine(TestTradeModelLineMixin):
         portal_type='Trade Model Line',
         **kw)
 
-  # Steps
-  def stepCreateBusinessState(self, sequence=None, **kw):
-    business_process = sequence.get('business_process')
-    sequence.edit(business_state=self.createBusinessState(business_process))
-
   def stepModifyBusinessPathDiscounting(self, sequence=None, **kw):
-    predecessor = sequence.get('business_state_invoiced')
-    successor = sequence.get('business_state_taxed')
+    category_tool = self.getCategoryTool()
+    predecessor = category_tool.trade_state.invoiced
+    successor = category_tool.trade_state.taxed
     business_path = sequence.get('business_path')
     self.assertNotEqual(None, predecessor)
     self.assertNotEqual(None, successor)
@@ -219,8 +211,9 @@ class TestTradeModelLine(TestTradeModelLineMixin):
     sequence.edit(business_path=None, business_path_discounting=business_path)
 
   def stepModifyBusinessPathTaxing(self, sequence=None, **kw):
-    predecessor = sequence.get('business_state_invoiced')
-    successor = sequence.get('business_state_taxed')
+    category_tool = self.getCategoryTool()
+    predecessor = category_tool.trade_state.invoiced
+    successor = category_tool.trade_state.taxed
     business_path = sequence.get('business_path')
     self.assertNotEqual(None, predecessor)
     self.assertNotEqual(None, successor)
@@ -232,17 +225,6 @@ class TestTradeModelLine(TestTradeModelLineMixin):
     )
     sequence.edit(business_path=None, business_path_taxing=business_path)
 
-  def stepModifyBusinessStateTaxed(self, sequence=None, **kw):
-    business_state = sequence.get('business_state')
-    business_state.edit(reference='taxed')
-    sequence.edit( business_state=None, business_state_taxed=business_state)
-
-  def stepModifyBusinessStateInvoiced(self, sequence=None,
-                sequence_string=None):
-    business_state = sequence.get('business_state')
-    business_state.edit(reference='invoiced')
-    sequence.edit(business_state=None, business_state_invoiced=business_state)
-
   def stepAcceptDecisionQuantityInvoice(self, sequence=None, **kw):
     invoice = sequence.get('invoice')
     solver_tool = self.portal.portal_solvers
@@ -1465,10 +1447,6 @@ class TestTradeModelLine(TestTradeModelLineMixin):
   ORDER_SPECIALISE_AGGREGATED_AMOUNT_COMMON_SEQUENCE_STRING = \
       COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
               CreateBusinessProcess
-              CreateBusinessState
-              ModifyBusinessStateTaxed
-              CreateBusinessState
-              ModifyBusinessStateInvoiced
               CreateBusinessPath
               ModifyBusinessPathTaxing
               CreateBusinessPath
@@ -1898,10 +1876,6 @@ class TestTradeModelLine(TestTradeModelLineMixin):
     sequence_list = SequenceList()
     sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
               CreateBusinessProcess
-              CreateBusinessState
-              ModifyBusinessStateTaxed
-              CreateBusinessState
-              ModifyBusinessStateInvoiced
               CreateBusinessPath
               ModifyBusinessPathTaxing
               CreateBusinessPath
@@ -1963,10 +1937,6 @@ class TestTradeModelLine(TestTradeModelLineMixin):
     sequence_list = SequenceList()
     sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
               CreateBusinessProcess
-              CreateBusinessState
-              ModifyBusinessStateTaxed
-              CreateBusinessState
-              ModifyBusinessStateInvoiced
               CreateBusinessPath
               ModifyBusinessPathTaxing
               CreateBusinessPath
-- 
2.30.9