[CMF-checkins] CVS: CMF/CMFCore/tests - test_DiscussionTool.py:1.3 test_WorkflowTool.py:1.6

Yvo Schubbe cvs-admin at zope.org
Fri Nov 14 03:34:57 EST 2003


Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv2437/CMFCore/tests

Modified Files:
	test_DiscussionTool.py test_WorkflowTool.py 
Log Message:
- updated interfaces/portal_actions.py to document the current state of Actions
- made implementations of OldstyleActionProvider explicit
- some whitespace and import cleanup


=== CMF/CMFCore/tests/test_DiscussionTool.py 1.2 => 1.3 ===
--- CMF/CMFCore/tests/test_DiscussionTool.py:1.2	Mon Jan  6 16:04:24 2003
+++ CMF/CMFCore/tests/test_DiscussionTool.py	Fri Nov 14 03:34:56 2003
@@ -2,6 +2,11 @@
 
 import Zope
 try:
+    Zope.startup()
+except AttributeError:
+    # for Zope versions before 2.6.1
+    pass
+try:
     from Interface.Verify import verifyClass
 except ImportError:
     # for Zope versions before 2.6.0
@@ -16,8 +21,11 @@
     def test_interface(self):
         from Products.CMFCore.interfaces.portal_discussion \
                 import oldstyle_portal_discussion as IOldstyleDiscussionTool
+        from Products.CMFCore.interfaces.portal_actions \
+                import OldstyleActionProvider as IOldstyleActionProvider
 
         verifyClass(IOldstyleDiscussionTool, DiscussionTool)
+        verifyClass(IOldstyleActionProvider, DiscussionTool)
 
 
 class OldDiscussableTests(TestCase):


=== CMF/CMFCore/tests/test_WorkflowTool.py 1.5 => 1.6 ===
--- CMF/CMFCore/tests/test_WorkflowTool.py:1.5	Sun Aug  4 18:59:12 2002
+++ CMF/CMFCore/tests/test_WorkflowTool.py	Fri Nov 14 03:34:56 2003
@@ -1,8 +1,22 @@
-import unittest
+from unittest import TestCase, TestSuite, makeSuite, main
+
+import Zope
+try:
+    Zope.startup()
+except AttributeError:
+    # for Zope versions before 2.6.1
+    pass
+try:
+    from Interface.Verify import verifyClass
+except ImportError:
+    # for Zope versions before 2.6.0
+    from Interface import verify_class_implementation as verifyClass
 
-import Zope # Sigh, make product initialization happen
 from OFS.SimpleItem import SimpleItem
 
+from Products.CMFCore.WorkflowTool import WorkflowTool
+
+
 class Dummy( SimpleItem ):
 
     def __init__( self, id ):
@@ -103,9 +117,9 @@
         if getattr( ob, 'meta_type', None ) is 'Dummy':
             return DummyTypeInfo( 'Dummy Content' )
         return None
-        
 
-class WorkflowToolTests( unittest.TestCase ):
+
+class WorkflowToolTests(TestCase):
 
     def setUp( self ):
         from Products.CMFCore.WorkflowTool import addWorkflowFactory
@@ -116,8 +130,6 @@
         _removeWorkflowFactory( DummyWorkflow )
 
     def _makeOne( self, workflow_ids=() ):
-
-        from Products.CMFCore.WorkflowTool import WorkflowTool
         tool = WorkflowTool()
 
         for workflow_id in workflow_ids:
@@ -143,16 +155,6 @@
         tool.setChainForPortalTypes( ( 'Dummy Content', ), ( 'a', 'b' ) )
         return tool
 
-    def test_interface( self ):
-        from Products.CMFCore.WorkflowTool import WorkflowTool
-        from Products.CMFCore.interfaces.portal_workflow import portal_workflow
-        try:
-            from Interface import verify_class_implementation as verifyClass
-        except ImportError:
-            from Interface.Verify import verifyClass
-
-        verifyClass(portal_workflow, WorkflowTool)
-
     def test_empty( self ):
 
         from Products.CMFCore.WorkflowTool import WorkflowException
@@ -308,18 +310,27 @@
             self.assertEqual( len( notified ), 1 )
             self.assertEqual( notified[0], ( ob, 'action', 'exception' ) )
 
-
     def xxx_test_updateRoleMappings( self ):
         """
             Build a tree of objects, invoke tool.updateRoleMappings,
             and then check to see that the workflows each got called;
             check the resulting count, as well.
         """
-        
+
+    def test_interface(self):
+        from Products.CMFCore.interfaces.portal_workflow \
+                import portal_workflow as IWorkflowTool
+        from Products.CMFCore.interfaces.portal_actions \
+                import OldstyleActionProvider as IOldstyleActionProvider
+
+        verifyClass(IWorkflowTool, WorkflowTool)
+        verifyClass(IOldstyleActionProvider, WorkflowTool)
+
+
 def test_suite():
-    return unittest.TestSuite((
-        unittest.makeSuite(WorkflowToolTests),
+    return TestSuite((
+        makeSuite(WorkflowToolTests),
         ))
 
 if __name__ == '__main__':
-    unittest.main()
+    main(defaultTest='test_suite')




More information about the CMF-checkins mailing list