From b3a8ab0e0f080fc58c9f74924283e4584af66a96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Fri, 9 Oct 2009 08:29:38 +0000
Subject: [PATCH]  - test category_publication_workflow as having specific
 scripts can lead to non functional system with errors unrelated to DCWorkflow

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

diff --git a/product/ERP5/tests/testERP5Web.py b/product/ERP5/tests/testERP5Web.py
index 8fd16cf641..6b4bd952b0 100644
--- a/product/ERP5/tests/testERP5Web.py
+++ b/product/ERP5/tests/testERP5Web.py
@@ -1402,8 +1402,39 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
     except Unauthorized:
       self.fail("A webmaster should be able to rename a Category.")
 
+class TestERP5WebCategoryPublicationWorkflow(ERP5TypeTestCase):
+  """Tests possible transitions for category_publication_workflow"""
+  def getBusinessTemplateList(self):
+    return ('erp5_base',
+            'erp5_web',
+            )
+
+  def afterSetUp(self):
+    base_category = self.getPortal().portal_categories\
+        .newContent(portal_type='Base Category')
+    self.doActionFor = self.getPortal().portal_workflow.doActionFor
+    self.category = base_category.newContent(portal_type='Category')
+    self.assertEqual('embedded', self.category.getValidationState())
+
+  def test_category_embedded_expired(self):
+    self.doActionFor(self.category, 'expire_action')
+    self.assertEqual('expired', self.category.getValidationState())
+
+  def test_category_embedded_protected_expired(self):
+    self.doActionFor(self.category, 'protect_action')
+    self.assertEqual('protected', self.category.getValidationState())
+    self.doActionFor(self.category, 'expire_action')
+    self.assertEqual('expired_protected', self.category.getValidationState())
+
+  def test_category_embedded_published_expired(self):
+    self.doActionFor(self.category, 'publish_action')
+    self.assertEqual('published', self.category.getValidationState())
+    self.doActionFor(self.category, 'expire_action')
+    self.assertEqual('expired_published', self.category.getValidationState())
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestERP5Web))
   suite.addTest(unittest.makeSuite(TestERP5WebWithSimpleSecurity))
+  suite.addTest(unittest.makeSuite(TestERP5WebCategoryPublicationWorkflow))
   return suite
-- 
2.30.9