[CMF-checkins] SVN: CMF/branches/2.0/CMFCore/tests/ fixed tests added in r69190: they expected the wrong behavior and just didn't fail because they were broken

Yvo Schubbe y.2006_ at wcm-solutions.de
Mon Oct 2 07:33:54 EDT 2006


Log message for revision 70471:
  fixed tests added in r69190: they expected the wrong behavior and just didn't fail because they were broken

Changed:
  U   CMF/branches/2.0/CMFCore/tests/base/dummy.py
  U   CMF/branches/2.0/CMFCore/tests/test_PortalContent.py

-=-
Modified: CMF/branches/2.0/CMFCore/tests/base/dummy.py
===================================================================
--- CMF/branches/2.0/CMFCore/tests/base/dummy.py	2006-10-02 11:10:43 UTC (rev 70470)
+++ CMF/branches/2.0/CMFCore/tests/base/dummy.py	2006-10-02 11:33:53 UTC (rev 70471)
@@ -88,31 +88,6 @@
         return True
 
 
-    def listActions(self, info=None, object=None):
-        rs = []
-        for k,v in self._actions.items():
-           rs.append( DummyAction( k,v ) )
-        return rs
-
-class DummyAction:
-
-    def __init__( self, id, target, permissions=() ):
-        self._id = id
-        self.target = target
-        self.permissions = permissions
-
-    def getId( self ):
-        return self._id
-
-    # can this be right? e.g. utils._getViewFor calls action
-    # attribute directly, which is not part of API but no other way
-    # to do it...
-    def action( self, context ):
-        return self.target
-
-    def getPermissions( self ):
-        return self.permissions
-
 class DummyContent( PortalContent, Item ):
     """
     A Dummy piece of PortalContent

Modified: CMF/branches/2.0/CMFCore/tests/test_PortalContent.py
===================================================================
--- CMF/branches/2.0/CMFCore/tests/test_PortalContent.py	2006-10-02 11:10:43 UTC (rev 70470)
+++ CMF/branches/2.0/CMFCore/tests/test_PortalContent.py	2006-10-02 11:33:53 UTC (rev 70471)
@@ -22,6 +22,7 @@
 from Acquisition import aq_base
 from OFS.Folder import Folder
 
+from Products.CMFCore.exceptions import NotFound
 from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFCore.tests.base.dummy import DummyObject
 from Products.CMFCore.tests.base.dummy import DummySite
@@ -29,6 +30,7 @@
 from Products.CMFCore.tests.base.dummy import DummyUserFolder
 from Products.CMFCore.tests.base.testcase import SecurityRequestTest
 
+
 class PortalContentTests(unittest.TestCase):
 
     def test_z2interfaces(self):
@@ -57,7 +59,7 @@
 
         # set up dummy type info with problematic double-default alias
         root._setObject( 'portal_types', DummyTool() )
-        root.portal_types.view_actions = aliases
+        root.portal_types._type_actions = aliases
 
         # dummy content and skin
         root._setObject( 'dummycontent', DummyContent() )
@@ -69,18 +71,16 @@
                          ('view', 'dummy_view'),
                        )
         ob = self._setupCallTests(test_aliases)
-        # in unfixed version fail here with AttributeError
-        # can end up with this arrangement using _getAliases though
-        # in fixed version, falls through to _getViewFor, which is BBB
-        self.assertEqual( ob(), 'dummy' )
+        # PortalContent no longer supports the BBB '(Default)' alias
+        self.assertRaises(NotFound, ob)
 
     def test_BlankDefaultAlias(self):
         test_aliases = ( ('(Default)', ''),
                          ('view', 'dummy_view'),
                        )
         ob = self._setupCallTests(test_aliases)
-        # blank default is BBB
-        self.assertEqual( ob(), 'dummy' )
+        # blank values are not valid
+        self.assertRaises(NotFound, ob)
 
     def test_SpecificAlias(self):
         test_aliases = ( ('(Default)', 'dummy_view'),
@@ -88,6 +88,7 @@
         ob = self._setupCallTests(test_aliases)
         self.assertEqual( ob(), 'dummy' )
 
+
 class TestContentCopyPaste(SecurityRequestTest):
 
     # Tests related to http://www.zope.org/Collectors/CMF/205



More information about the CMF-checkins mailing list