[CMF-checkins] SVN: CMF/branches/CMF-1_5-branch/C Fix
DefaultWorkflowDefinition bug on isActionSupported() for the
Julien Anguenot
ja at nuxeo.com
Mon Jul 18 10:20:02 EDT 2005
Log message for revision 37237:
Fix DefaultWorkflowDefinition bug on isActionSupported() for the
keywargs support to reflect DCWorkflowDefinition changes. Add test
case for this definition as well.
Changed:
U CMF/branches/CMF-1_5-branch/CHANGES.txt
U CMF/branches/CMF-1_5-branch/CMFDefault/DefaultWorkflow.py
A CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_default_workflow.py
-=-
Modified: CMF/branches/CMF-1_5-branch/CHANGES.txt
===================================================================
--- CMF/branches/CMF-1_5-branch/CHANGES.txt 2005-07-18 12:57:45 UTC (rev 37236)
+++ CMF/branches/CMF-1_5-branch/CHANGES.txt 2005-07-18 14:20:02 UTC (rev 37237)
@@ -1,6 +1,12 @@
After CMF 1.5.2
+Bugs Fixed
+ - Fix DefaultWorkflowDefinition bug on isActionSupported() for the
+ keywargs support to reflect DCWorkflowDefinition changes. Add a
+ test case for this definition as well.
+
+
CMF 1.5.2 (2005/07/17)
Bugs Fixed
Modified: CMF/branches/CMF-1_5-branch/CMFDefault/DefaultWorkflow.py
===================================================================
--- CMF/branches/CMF-1_5-branch/CMFDefault/DefaultWorkflow.py 2005-07-18 12:57:45 UTC (rev 37236)
+++ CMF/branches/CMF-1_5-branch/CMFDefault/DefaultWorkflow.py 2005-07-18 14:20:02 UTC (rev 37237)
@@ -168,7 +168,7 @@
return actions
security.declarePrivate('isActionSupported')
- def isActionSupported(self, ob, action):
+ def isActionSupported(self, ob, action, **kw):
'''
Returns a true value if the given action name is supported.
'''
Added: CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_default_workflow.py
===================================================================
--- CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_default_workflow.py 2005-07-18 12:57:45 UTC (rev 37236)
+++ CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_default_workflow.py 2005-07-18 14:20:02 UTC (rev 37237)
@@ -0,0 +1,97 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for the default workflow definition module.
+
+$Id$
+"""
+
+from unittest import TestCase, TestSuite, makeSuite, main
+import Testing
+import Zope2
+Zope2.startup()
+
+from Products.CMFCore.tests.base.dummy import DummyContent
+from Products.CMFCore.tests.base.dummy import DummySite
+from Products.CMFCore.tests.base.dummy import DummyTool
+from Products.CMFCore.tests.base.dummy import DummyUserFolder
+
+from Products.CMFCore.WorkflowTool import addWorkflowFactory
+from Products.CMFCore.WorkflowTool import WorkflowTool
+
+from Products.CMFDefault.MembershipTool import MembershipTool
+from Products.CMFDefault.DefaultWorkflow import DefaultWorkflowDefinition
+
+class DefaultWorkflowDefinitionTests(TestCase):
+
+ def setUp(self):
+
+ self.site = DummySite('site')
+ self.site._setObject('portal_types', DummyTool())
+ self.site._setObject('portal_workflow', WorkflowTool())
+ self.site._setObject('portal_membership', MembershipTool())
+ self.site._setObject('acl_users', DummyUserFolder())
+
+ addWorkflowFactory(DefaultWorkflowDefinition,
+ id='default_workflow', title='default_workflow')
+
+ self._constructDummyWorkflow()
+
+ def test_z2interfaces(self):
+ from Interface.Verify import verifyClass
+ from Products.CMFCore.interfaces.portal_workflow \
+ import WorkflowDefinition as IWorkflowDefinition
+
+ verifyClass(IWorkflowDefinition, DefaultWorkflowDefinition)
+
+ def test_z3interfaces(self):
+ from zope.interface.verify import verifyClass
+ from Products.CMFCore.interfaces import IWorkflowDefinition
+
+ verifyClass(IWorkflowDefinition, DefaultWorkflowDefinition)
+
+ def _constructDummyWorkflow(self):
+
+ wftool = self.site.portal_workflow
+ wftool.manage_addWorkflow('default_workflow (default_workflow)', 'wf')
+ wftool.setDefaultChain('wf')
+
+ def _getDummyWorkflow(self):
+ wftool = self.site.portal_workflow
+ return wftool.wf
+
+ def test_isActionSupported(self):
+
+ wf = self._getDummyWorkflow()
+ dummy = self.site._setObject('dummy', DummyContent())
+
+ for action in ('submit', 'retract', 'publish', 'reject',):
+ self.assert_(wf.isActionSupported(dummy, action))
+
+ def test_isActionSupported_with_keywargs(self):
+
+ wf = self._getDummyWorkflow()
+ dummy = self.site._setObject('dummy', DummyContent())
+
+ for action in ('submit', 'retract', 'publish', 'reject',):
+ self.assert_(wf.isActionSupported(dummy, action,
+ arg1=1, arg2=2))
+
+ # XXX more tests...
+
+def test_suite():
+ return TestSuite((
+ makeSuite(DefaultWorkflowDefinitionTests),
+ ))
+
+if __name__ == '__main__':
+ main(defaultTest='test_suite')
Property changes on: CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_default_workflow.py
___________________________________________________________________
Name: svn:keywords
+ Id
More information about the CMF-checkins
mailing list