[CMF-checkins] CVS: CMF/CMFCore/tests - test_WorkflowTool.py:1.4

Florent Guillaume fg@nuxeo.com
Sun, 4 Aug 2002 11:25:14 -0400


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

Modified Files:
	test_WorkflowTool.py 
Log Message:
Merged change from CMF-1_3-branch, with additionnal test:

Fixed WorkflowTool so that it doesn't pretend to workflow non-CMF
objects (Collector #19).



=== CMF/CMFCore/tests/test_WorkflowTool.py 1.3 => 1.4 ===
 class DummyContent( Dummy ):
 
     meta_type = 'DummyContent'
+    portal_type = 'DummyContentPT'
     _isPortalContent = 1
 
+class DummyNotReallyContent( Dummy ):
+
+    meta_type = 'DummyContentPT'
+
 class DummyTypeInfo( Dummy ):
 
     pass
@@ -92,11 +97,11 @@
 class DummyTypesTool( SimpleItem ):
 
     def listTypeInfo( self ):
-        return [ DummyTypeInfo( 'DummyContent' ) ]
+        return [ DummyTypeInfo( 'DummyContentPT' ) ]
 
     def getTypeInfo( self, ob ):
         if getattr( ob, 'meta_type', None ) is 'DummyContent':
-            return DummyTypeInfo( 'DummyContent' )
+            return DummyTypeInfo( 'DummyContentPT' )
         return None
         
 
@@ -135,7 +140,7 @@
     def _makeWithTypesAndChain( self ):
 
         tool = self._makeWithTypes()
-        tool.setChainForPortalTypes( ( 'DummyContent', ), ( 'a', 'b' ) )
+        tool.setChainForPortalTypes( ( 'DummyContentPT', ), ( 'a', 'b' ) )
         return tool
 
     def test_interface( self ):
@@ -186,6 +191,14 @@
         self.assertEquals( len( tool.getDefaultChainFor( None ) ), 0 )
         self.assertEquals( len( tool.getChainFor( None ) ), 0 )
         self.assertEquals( len( tool.getCatalogVariablesFor( None ) ), 0 )
+
+    def test_notReallyContent( self ):
+
+        tool = self._makeWithTypesAndChain()
+        dummy = DummyNotReallyContent( 'doh' )
+        self.assertEquals( len( tool.getDefaultChainFor( dummy ) ), 0 )
+        self.assertEquals( len( tool.getChainFor( dummy ) ), 0 )
+        self.assertEquals( len( tool.getCatalogVariablesFor( dummy ) ), 0 )
 
     def test_content_default_chain( self ):