From 207d385ada30079d8fe36d5a76bb7705d1d7869c Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Tue, 2 Dec 2008 21:17:41 +0000
Subject: [PATCH] Split testWorklist so that we can easily check if worklists
 without related key work with the cache.

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

diff --git a/product/ERP5/tests/testWorklist.py b/product/ERP5/tests/testWorklist.py
index 2d7a212993..e49a857c19 100644
--- a/product/ERP5/tests/testWorklist.py
+++ b/product/ERP5/tests/testWorklist.py
@@ -195,7 +195,7 @@ class TestWorklist(ERP5TypeTestCase):
       self.assertEquals(count,
         self.getWorklistDocumentCountFromActionName(entry_list[0]['name']))
 
-  def test_01_worklist(self, quiet=0, run=run_all_test):
+  def test_01_permission(self, quiet=0, run=run_all_test):
     """
     Test the permission of the building module.
     """
@@ -331,13 +331,17 @@ class TestWorklist(ERP5TypeTestCase):
           current_sql_catalog_local_role_keys
       get_transaction().commit()
 
-    #
-    # Test related keys
-    #
-    self.logMessage("Test related keys")
-    self.addWorkflowCataloguedVariable(self.checked_workflow,
-                                       'base_category_id')
+  def test_02_related_key(self, quiet=0, run=run_all_test):
+    """
+    Test related keys
+    """
+    if not run:
+      return
+
+    workflow_tool = self.getWorkflowTool()
+    self.createManagerAndLogin()
 
+    self.logMessage("Create categories")
     for base_category, category_list in (
         ('region', ('somewhere', 'elsewhere')),
         ('role',   ('client',    'supplier'))):
@@ -345,6 +349,9 @@ class TestWorklist(ERP5TypeTestCase):
       for category in category_list:
         newContent(portal_type='Category', id=category)
 
+    self.logMessage("Create worklists using 'base_category_id' related key")
+    self.addWorkflowCataloguedVariable(self.checked_workflow,
+                                       'base_category_id')
     self.createWorklist(self.checked_workflow, 'region_worklist', 'has_region',
                         portal_type=self.checked_portal_type,
                         base_category_id='region')
@@ -352,6 +359,7 @@ class TestWorklist(ERP5TypeTestCase):
                         portal_type=self.checked_portal_type,
                         base_category_id='role')
 
+    document = self.createDocument()
     get_transaction().commit()
     self.tic()
     self.clearCache()
-- 
2.30.9