[CMF-checkins]
SVN: CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_
Fix bad test location
Julien Anguenot
ja at nuxeo.com
Mon Jul 18 12:24:02 EDT 2005
Log message for revision 37242:
Fix bad test location
Changed:
U CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_DefaultWorkflow.py
D CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_default_workflow.py
-=-
Modified: CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_DefaultWorkflow.py
===================================================================
--- CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_DefaultWorkflow.py 2005-07-18 15:46:58 UTC (rev 37241)
+++ CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_DefaultWorkflow.py 2005-07-18 16:24:01 UTC (rev 37242)
@@ -23,9 +23,32 @@
import Zope as 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 \
@@ -47,7 +70,35 @@
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 ),
Deleted: 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 15:46:58 UTC (rev 37241)
+++ CMF/branches/CMF-1_5-branch/CMFDefault/tests/test_default_workflow.py 2005-07-18 16:24:01 UTC (rev 37242)
@@ -1,97 +0,0 @@
-##############################################################################
-#
-# 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')
More information about the CMF-checkins
mailing list