From 3e6f949d77ca60fd212116bbe3b2fae489a6a472 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 21 Feb 2008 18:24:42 +0000
Subject: [PATCH] update tests for new sale opportunity workflow

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19459 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testCrmReports.py | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/tests/testCrmReports.py b/product/ERP5/tests/testCrmReports.py
index 6c10cc540b..9729c0d86a 100644
--- a/product/ERP5/tests/testCrmReports.py
+++ b/product/ERP5/tests/testCrmReports.py
@@ -76,10 +76,19 @@ class CrmTestCase(ERP5TypeTestCase):
     elif portal_type == ('Support Request'):
       tk = self.support_request_module.newContent(portal_type=portal_type,**kw)
 
-    if simulation_state == 'validated':
-      tk.validate()
-    elif simulation_state == 'offered': #for Sale Opportunity workflow
-      tk.offer()
+    # not all states are implemented here for now.
+    if portal_type == 'Sale Opportunity':
+      # Sale Opportunity have a different workflow.
+      if simulation_state in ('contacted', 'offered',):
+        tk.validate()
+      if simulation_state == 'offered':
+        tk.offer()
+    else:
+      if simulation_state == 'validated':
+        tk.validate()
+    
+    # sanity check
+    self.assertEquals(simulation_state, tk.getSimulationState())
     return tk
 
   def _makeOneEvent(self, portal_type='Fax Message', 
@@ -134,6 +143,8 @@ class CrmTestCase(ERP5TypeTestCase):
     elif simulation_state == 'ordered':
       ev.plan()
       ev.order()
+    # sanity check
+    self.assertEquals(simulation_state, ev.getSimulationState())
     return ev
 
   def login(self):
-- 
2.30.9