From 02617775e5bd179a5899d434b84fe1563268cdc4 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Wed, 28 Sep 2005 13:09:49 +0000
Subject: [PATCH] make sure we do not do workflow transition when we are in
 building state

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3894 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testInventory.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/product/ERP5/tests/testInventory.py b/product/ERP5/tests/testInventory.py
index a15f045ea4..ba204d4602 100755
--- a/product/ERP5/tests/testInventory.py
+++ b/product/ERP5/tests/testInventory.py
@@ -84,6 +84,20 @@ class TestInventory(TestOrderMixin,ERP5TypeTestCase):
   def getTitle(self):
     return "Inventory"
 
+  def afterSetUp(self, quiet=1, run=run_all_test):
+    self.login()
+    portal = self.getPortal()
+    self.category_tool = self.getCategoryTool()
+    portal_catalog = self.getCatalogTool()
+    self.createCategories()
+    # Patch PackingList.asPacked so that we do not need
+    # to manage containers here, this not the job of this
+    # test
+    def isPacked(self):
+      return 1
+    from Products.ERP5Type.Document.PackingList import PackingList
+    PackingList.isPacked = isPacked
+
   def enableLightInstall(self):
     """
     You can override this. 
@@ -196,6 +210,11 @@ class TestInventory(TestOrderMixin,ERP5TypeTestCase):
     sequence.edit(packing_list = packing_list)
     workflow_tool = self.getPortal().portal_workflow
     workflow_tool.doActionFor(sequence.get('packing_list'), "confirm_action", "packing_list_workflow")
+    # Apply tic so that the packing list is not in building state
+    self.tic() # acceptable here because this is not the job
+               # of the test to check if can do all transition
+               # without processing messages
+    packing_list = sequence.get('packing_list')
     workflow_tool.doActionFor(sequence.get('packing_list'), "set_ready_action", "packing_list_workflow")
     workflow_tool.doActionFor(sequence.get('packing_list'), "start_action", "packing_list_workflow")
     
@@ -1007,6 +1026,9 @@ class TestInventory(TestOrderMixin,ERP5TypeTestCase):
       
     i = 0
     for expected_values in expected_values_list[1:]:
+      self.tic() # acceptable here because this is not the job
+                 # of the test to check if can do all transition
+                 # without processing messages
       transition_step = transition_list[i]
       transited_pl = packing_list_list[transition_step['id']]
       action = transition_step['action']
-- 
2.30.9