[CMF-checkins] CVS: CMF/CMFCore/tests - test_ActionInformation.py:1.3 test_ActionProviderBase.py:1.2 test_ActionsTool.py:1.4 test_CatalogTool.py:1.2 test_ContentTypeRegistry.py:1.7 test_DirectoryView.py:1.4 test_Expression.py:1.3 test_FSPageTemplate.py:1.2 test_FSPythonScript.py:1.3 test_PortalFolder.py:1.16 test_TypesTool.py:1.13 test_all.py:1.14

Chris Withers chrisw@nipltd.com
Fri, 15 Feb 2002 14:46:04 -0500


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

Modified Files:
	test_ActionInformation.py test_ActionProviderBase.py 
	test_ActionsTool.py test_CatalogTool.py 
	test_ContentTypeRegistry.py test_DirectoryView.py 
	test_Expression.py test_FSPageTemplate.py 
	test_FSPythonScript.py test_PortalFolder.py test_TypesTool.py 
	test_all.py 
Log Message:
The unit tests hopefully smell better now. Please try and keep them this way. Look in CMFCore/tests/base for commonly used artifacts.

=== CMF/CMFCore/tests/test_ActionInformation.py 1.2 => 1.3 ===
-from Products.CMFDefault.MembershipTool import *
-from Products.CMFCore.PortalContent import PortalContent
-from Products.CMFCore.ActionInformation import ActionInformation
-from Products.CMFCore.Expression import Expression, createExprContext
+import Zope
+from unittest import TestSuite, makeSuite, main
 
-class DummyMembershipTool:
-    def isAnonymousUser(self):
-        return 1
-  
-class DummyContent(PortalContent, OFS.SimpleItem.Item):
-    """
-    """
-    meta_type = 'Dummy'
-    url = 'foo_url'
+from Products.CMFCore.tests.base.testcase import \
+     TransactionalTest
 
-    def __init__(self, id, url=None):
-       self.url = url
+from Products.CMFCore.tests.base.dummy import \
+     DummyContent, DummyTool as DummyMembershipTool
 
-    def absolute_url(self):
-       return self.url
+from Products.CMFCore.ActionInformation import ActionInformation
+from Products.CMFCore.Expression import Expression, createExprContext
 
-class ActionInformationTests(unittest.TestCase):
+class ActionInformationTests(TransactionalTest):
     
     def setUp( self ):
-        get_transaction().begin()
-        self.connection = Zope.DB.open()
-        root = self.root = self.connection.root()[ 'Application' ]
+
+        TransactionalTest.setUp( self )
+
+        root = self.root
         root._setObject('portal', DummyContent('portal', 'url_portal'))
-        portal = self.portal = self.root.portal
+        portal = self.portal = root.portal
         portal.portal_membership = DummyMembershipTool()
         self.folder = DummyContent('foo', 'url_foo')
         self.object = DummyContent('bar', 'url_bar')
@@ -77,18 +68,10 @@
         ec = createExprContext(folder, portal, object)
         self.failIf(ai.testCondition(ec))
         
-    def tearDown( self ):
-        get_transaction().abort()
-        self.connection.close()
-        
-
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(ActionInformationTests))
-    return suite
-
-def run():
-    unittest.TextTestRunner().run(test_suite())
+    return TestSuite((
+        makeSuite(ActionInformationTests),
+        ))
 
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')


=== CMF/CMFCore/tests/test_ActionProviderBase.py 1.1 => 1.2 ===
+import Zope
+from unittest import TestCase, TestSuite, makeSuite, main
 
-class DummyAction:
-    def __init__( self, **kw ):
-        self.__dict__.update( kw )
+from Products.CMFCore.tests.base.dummy import \
+     DummyTool
 
-class ActionProviderBaseTests(unittest.TestCase):
+from Products.CMFCore.ActionProviderBase import ActionProviderBase
+
+class ActionProviderBaseTests(TestCase):
     
     def _makeProvider( self ):
 
-        from Products.CMFCore.ActionProviderBase import ActionProviderBase
         return ActionProviderBase()
 
     def test_addAction( self ):
@@ -28,12 +29,6 @@
 
     def test_changeActions( self ):
 
-        from Products.CMFCore.ActionProviderBase import ActionProviderBase
-
-        class DummyTool( ActionProviderBase ):
-            _actions = [ DummyAction()
-                       , DummyAction()
-                       ]
 
         apb = DummyTool()
         old_actions = apb._actions
@@ -91,12 +86,9 @@
         self.assertEqual( apb._actions, ['1'] )
 
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(ActionProviderBaseTests))
-    return suite
-
-def run():
-    unittest.TextTestRunner().run(test_suite())
+    return TestSuite((
+        makeSuite(ActionProviderBaseTests),
+        ))
 
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')


=== CMF/CMFCore/tests/test_ActionsTool.py 1.3 => 1.4 ===
 from unittest import TestCase,TestSuite,makeSuite,main
+
+from Products.CMFCore.tests.base.testcase import \
+     SecurityRequestTest
+
 from Products.CMFCore.ActionsTool import ActionsTool
 from Products.CMFCore.TypesTool import TypesTool
 from Products.CMFCore.PortalFolder import PortalFolder
 from Products.CMFDefault.URLTool import URLTool
 from Products.CMFDefault.RegistrationTool import RegistrationTool
 from Products.CMFDefault.MembershipTool import MembershipTool
-from AccessControl import SecurityManager
-from AccessControl.SecurityManagement import newSecurityManager
-import ZPublisher.HTTPRequest
-from Testing.makerequest import makerequest
-from Acquisition import Implicit
-
-class UnitTestUser( Implicit ):
-    """
-        Stubbed out manager for unit testing purposes.
-    """
-    id = 'unit_tester'
-    
-    def getId( self ):
-        return self.id
-    
-    getUserName = getId
-
-    def allowed( self, object, object_roles=None ):
-        return 1
-
-class UnitTestSecurityPolicy:
-    """
-        Stub out the existing security policy for unit testing purposes.
-    """
-    #
-    #   Standard SecurityPolicy interface
-    #
-    def validate( self
-                , accessed=None
-                , container=None
-                , name=None
-                , value=None
-                , context=None
-                , roles=None
-                , *args
-                , **kw):
-        return 1
-    
-    def checkPermission( self, permission, object, context) :
-        return 1
 
-class ActionsToolTests( TestCase ):
+class ActionsToolTests( SecurityRequestTest ):
 
     def setUp( self ):
-        get_transaction().begin()
-        self._policy = UnitTestSecurityPolicy()
-        self._oldPolicy = SecurityManager.setSecurityPolicy(self._policy)
-        self.connection = Zope.DB.open()
-        self.root = root = self.connection.root()[ 'Application' ]
-        newSecurityManager( None, UnitTestUser().__of__( self.root ) )
         
-        root = self.root = makerequest(root)
+        SecurityRequestTest.setUp(self)
         
+        root = self.root
         root._setObject( 'portal_actions', ActionsTool() )
         root._setObject('foo', URLTool() )
         self.tool = root.portal_actions
         self.ut = root.foo
         self.tool.action_providers = ('portal_actions',)
 
-
-    def tearDown(self):
-        SecurityManager.setSecurityPolicy( self._oldPolicy )
-        get_transaction().abort()
-        self.connection.close()
-        
     def test_actionProviders(self):
         tool = self.tool
         self.assertEqual(tool.listActionProviders(), ('portal_actions',))
@@ -137,8 +90,5 @@
         makeSuite(ActionsToolTests),
         ))
 
-def run():
-    main(defaultTest='test_suite')
-
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')


=== CMF/CMFCore/tests/test_CatalogTool.py 1.1 => 1.2 ===
-import unittest
-import OFS.Folder, OFS.SimpleItem
-import Acquisition
-from Products.CMFCore.CatalogTool import *
-from Products.CMFCore.PortalContent import PortalContent
-
-
-class DummyContent( PortalContent, OFS.SimpleItem.Item ):
-    """
-    """
-    meta_type = 'Dummy'
-
-class CatalogToolTests( unittest.TestCase ):
-
-    def setUp( self ):
-        get_transaction().begin()
-    
-    def tearDown( self ):
-        get_transaction().abort()
+from unittest import TestCase, TestSuite, makeSuite, main
+
+from Products.CMFCore.tests.base.dummy import \
+     DummyContent
+
+from Products.CMFCore.CatalogTool import CatalogTool
+
+class CatalogToolTests( TestCase ):
 
     def test_processActions( self ):
         """
@@ -25,18 +14,15 @@
             argument, 'idxs', to 'catalog_object'.
         """
         tool = CatalogTool()
-        dummy = DummyContent()
+        dummy = DummyContent(catalog=1)
 
         tool.catalog_object( dummy, '/dummy' )
         tool.catalog_object( dummy, '/dummy', [ 'SearchableText' ] )
 
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest( unittest.makeSuite( CatalogToolTests ) )
-    return suite
-
-def run():
-    unittest.TextTestRunner().run(test_suite())
+    return TestSuite((
+        makeSuite( CatalogToolTests ),
+        ))
 
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')


=== CMF/CMFCore/tests/test_ContentTypeRegistry.py 1.6 => 1.7 ===
-import unittest
-import re
-from Products.CMFCore.ContentTypeRegistry import *
+from unittest import TestCase, TestSuite, makeSuite, main
 
-class MajorMinorPredicateTests( unittest.TestCase ):
+from Products.CMFCore.ContentTypeRegistry import \
+     ContentTypeRegistry,MajorMinorPredicate,ExtensionPredicate, \
+     NameRegexPredicate, MimeTypeRegexPredicate
 
-    def setUp( self ):
-        get_transaction().begin()
-
-    def tearDown( self ):
-        get_transaction().abort()
+class MajorMinorPredicateTests( TestCase ):
 
     def test_empty( self ):
         pred = MajorMinorPredicate( 'empty' )
@@ -43,13 +39,7 @@
         assert pred( 'foo', 'text/html', 'asdfljksadf' )
         assert not pred( 'foo', 'image/png', 'asdfljksadf' )
 
-class ExtensionPredicateTests( unittest.TestCase ):
-
-    def setUp( self ):
-        get_transaction().begin()
-
-    def tearDown( self ):
-        get_transaction().abort()
+class ExtensionPredicateTests( TestCase ):
 
     def test_empty( self ):
         pred = ExtensionPredicate( 'empty' )
@@ -77,13 +67,7 @@
         assert pred( 'foo.htm', 'text/plain', 'asdfljksadf' )
         assert not pred( 'foo.bar', 'text/html', 'asdfljksadf' )
 
-class MimeTypeRegexPredicateTests( unittest.TestCase ):
-
-    def setUp( self ):
-        get_transaction().begin()
-
-    def tearDown( self ):
-        get_transaction().abort()
+class MimeTypeRegexPredicateTests( TestCase ):
 
     def test_empty( self ):
         pred = MimeTypeRegexPredicate( 'empty' )
@@ -105,13 +89,7 @@
         assert pred( 'foo', 'text/html', 'asdfljksadf' )
         assert not pred( 'foo', 'image/png', 'asdfljksadf' )
     
-class NameRegexPredicateTests( unittest.TestCase ):
-
-    def setUp( self ):
-        get_transaction().begin()
-
-    def tearDown( self ):
-        get_transaction().abort()
+class NameRegexPredicateTests( TestCase ):
 
     def test_empty( self ):
         pred = NameRegexPredicate( 'empty' )
@@ -134,16 +112,13 @@
         assert pred( 'fargo', 'text/plain', 'asdfljksadf' )
         assert not pred( 'bar', 'text/plain', 'asdfljksadf' )
     
-class ContentTypeRegistryTests( unittest.TestCase ):
+class ContentTypeRegistryTests( TestCase ):
 
     def setUp( self ):
-        get_transaction().begin()
-
-    def tearDown( self ):
-        get_transaction().abort()
+        self.reg = ContentTypeRegistry()
 
     def test_empty( self ):
-        reg = ContentTypeRegistry()
+        reg=self.reg
         assert reg.findTypeName( 'foo', 'text/plain', 'asdfljksadf' ) is None
         assert reg.findTypeName( 'fargo', 'text/plain', 'asdfljksadf' ) is None
         assert reg.findTypeName( 'bar', 'text/plain', 'asdfljksadf' ) is None
@@ -151,7 +126,7 @@
         self.assertRaises( KeyError, reg.removePredicate, 'xyzzy' )
     
     def test_reorder( self ):
-        reg = ContentTypeRegistry()
+        reg=self.reg
         predIDs = ( 'foo', 'bar', 'baz', 'qux' )
         for predID in predIDs:
             reg.addPredicate( predID, 'name_regex' )
@@ -162,7 +137,7 @@
         assert ids == ( 'foo', 'baz', 'qux', 'bar' )
 
     def test_lookup( self ):
-        reg = ContentTypeRegistry()
+        reg=self.reg
         reg.addPredicate( 'image', 'major_minor' )
         reg.getPredicate( 'image' ).edit( 'image', '' )
         reg.addPredicate( 'onlyfoo', 'name_regex' )
@@ -175,16 +150,13 @@
         assert reg.findTypeName( 'foo', None, None ) == 'Foo'
 
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest( unittest.makeSuite( MajorMinorPredicateTests ) )
-    suite.addTest( unittest.makeSuite( ExtensionPredicateTests ) )
-    suite.addTest( unittest.makeSuite( MimeTypeRegexPredicateTests ) )
-    suite.addTest( unittest.makeSuite( NameRegexPredicateTests ) )
-    suite.addTest( unittest.makeSuite( ContentTypeRegistryTests ) )
-    return suite
-
-def run():
-    unittest.TextTestRunner().run(test_suite())
+    return TestSuite((
+        makeSuite( MajorMinorPredicateTests ),
+        makeSuite( ExtensionPredicateTests ),
+        makeSuite( MimeTypeRegexPredicateTests ),
+        makeSuite( NameRegexPredicateTests ),
+        makeSuite( ContentTypeRegistryTests ),
+        ))
 
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')


=== CMF/CMFCore/tests/test_DirectoryView.py 1.3 => 1.4 ===
 from unittest import TestCase, TestSuite, makeSuite, main
+
+from Products.CMFCore.tests.base.dummy import \
+     DummyFolder
+
 from Products.CMFCore.DirectoryView import \
      registerDirectory,addDirectoryViews,DirectoryViewSurrogate
 from Globals import package_home, DevelopmentMode
-from Acquisition import Implicit
-import os
-from os import remove, mkdir, rmdir
-from os.path import join
+
+from os import remove, mkdir, rmdir, curdir
+from os.path import join, abspath, dirname
 from shutil import copy2
 
 try:
     __file__
 except NameError:
     # Test was called directly, so no __file__ global exists.
-    _prefix = os.path.abspath(os.curdir)
+    _prefix = abspath(curdir)
 else:
     # Test was called by another test.
-    _prefix = os.path.abspath(os.path.dirname(__file__))
+    _prefix = abspath(dirname(__file__))
 
 # the path of our fake skin
 skin_path_name = join(_prefix, 'fake_skins', 'fake_skin')
@@ -27,20 +30,11 @@
         """ Test registerDirectory  """
         registerDirectory('fake_skins', _prefix)
 
-class Dummy(Implicit):
-    """
-    A Dummy object to use in place of the skins tool
-    """
-
-    def _setObject(self,id,object):
-        """ Dummy _setObject method """
-        setattr(self,id,object)
-
 class DirectoryViewTests2( TestCase ):
 
     def setUp( self ):
         registerDirectory('fake_skins', _prefix)
-        ob = self.ob = Dummy()
+        ob = self.ob = DummyFolder()
         addDirectoryViews(ob, 'fake_skins', _prefix)
 
     def test_addDirectoryViews( self ):
@@ -71,7 +65,7 @@
         
         # initialise skins
         registerDirectory('fake_skins', _prefix)
-        ob = self.ob = Dummy()
+        ob = self.ob = DummyFolder()
         addDirectoryViews(ob, 'fake_skins', _prefix)
 
         # add a method to the fake skin folder
@@ -121,7 +115,6 @@
         """
         See if a new folder shows up
         """
-        # This fails for some bizarre reason :-( - CW
         self.failUnless(isinstance(self.ob.fake_skin.test3,DirectoryViewSurrogate))
         self.ob.fake_skin.test3.objectIds()
 
@@ -161,11 +154,8 @@
         makeSuite(DebugModeTests),
         ))
 
-def run():
-    main(defaultTest='test_suite')
-
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')
 
 
 


=== CMF/CMFCore/tests/test_Expression.py 1.2 => 1.3 ===
-from AccessControl.SecurityManagement import newSecurityManager
-from AccessControl.SecurityManagement import noSecurityManager
-from AccessControl import SecurityManager
-from Products.CMFCore.ActionsTool import *
-from Products.CMFCore.ActionInformation import ActionInformation
-from Products.CMFCore.PortalContent import PortalContent
-from Products.CMFCore.Expression import Expression, createExprContext
-import ZPublisher.HTTPRequest
+import Zope
+from unittest import TestSuite, makeSuite, main
+
+from Products.CMFCore.tests.base.testcase import \
+     SecurityTest
 
-class PermissiveSecurityPolicy:
-    """
-        Stub out the existing security policy for unit testing purposes.
-    """
-    #
-    #   Standard SecurityPolicy interface
-    #
-    def validate( self
-                , accessed=None
-                , container=None
-                , name=None
-                , value=None
-                , context=None
-                , roles=None
-                , *args
-                , **kw):
-        return 1
-    
-    def checkPermission( self, permission, object, context) :
-        if permission == 'forbidden permission':
-            return 0
-        return 1
-
-class UnitTestUser( Acquisition.Implicit ):
-    """
-        Stubbed out manager for unit testing purposes.
-    """
-    def getId( self ):
-        return 'unit_tester'
-    
-    getUserName = getId
-
-    def allowed( self, object, object_roles=None ):
-        # for testing permissions on actions
-        if object.getId() == 'actions_dummy':
-            if 'Anonymous' in object_roles:
-                return 1
-            else:
-                return 0
-        return 1
-
-class DummyMembershipTool:
-    def __init__(self, anon=1):
-        self.anon = anon 
-
-    def isAnonymousUser(self):
-        return self.anon 
-
-    def getAuthenticatedMember(self):
-        return "member"
-  
-class DummyContent(PortalContent, OFS.SimpleItem.Item):
-    """
-    """
-    meta_type = 'Dummy'
-    url = 'foo_url'
-
-    def __init__(self, id, url=None):
-       self.id = id
-       self.url = url
+from Products.CMFCore.tests.base.dummy import \
+     DummyContent, DummyTool as DummyMembershipTool
 
-    def absolute_url(self):
-       return self.url
+from Products.CMFCore.ActionInformation import ActionInformation
+from Products.CMFCore.Expression import Expression, createExprContext
 
-class ExpressionTests( unittest.TestCase ):
+class ExpressionTests( SecurityTest ):
 
     def setUp( self ):
-        get_transaction().begin()
-        self._policy = PermissiveSecurityPolicy()
-        self._oldPolicy = SecurityManager.setSecurityPolicy(self._policy)
-        self.connection = Zope.DB.open()
-        root = self.root = self.connection.root()[ 'Application' ]
-        newSecurityManager(None, UnitTestUser().__of__( self.root ))
-        root._setObject('portal', DummyContent('portal', 'url_portal'))
-        portal = self.portal = self.root.portal
-        self.folder = DummyContent('foo', 'url_foo')
-        self.object = DummyContent('bar', 'url_bar')
+        
+        SecurityTest.setUp(self)
+        root = self.root
+        root._setObject('portal', DummyContent('portal', url='url_portal'))
+        portal = self.portal = root.portal
+        self.folder = DummyContent('foo', url='url_foo')
+        self.object = DummyContent('bar', url='url_bar')
         self.ai = ActionInformation(id='view'
                                   , title='View'
                                   , action=Expression(
@@ -123,21 +58,10 @@
         self.assertEqual(folder.id, 'foo')
         self.assertEqual(folder.absolute_url(), 'url_foo')
         
-
-
-    def tearDown( self ):
-        get_transaction().abort()
-        self.connection.close()
-        noSecurityManager()
-        SecurityManager.setSecurityPolicy(self._oldPolicy)
-
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(ExpressionTests))
-    return suite
-
-def run():
-    unittest.TextTestRunner().run(test_suite())
+    return TestSuite((
+        makeSuite(ExpressionTests),
+        ))
 
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')


=== CMF/CMFCore/tests/test_FSPageTemplate.py 1.1 => 1.2 ===
         ))
 
-def run():
-    main(defaultTest='test_suite')
-
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')
 
 
 


=== CMF/CMFCore/tests/test_FSPythonScript.py 1.2 => 1.3 ===
         ))
 
-def run():
-    main(defaultTest='test_suite')
-
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')
 
 
 


=== CMF/CMFCore/tests/test_PortalFolder.py 1.15 => 1.16 ===
-import unittest
-import re, new
-import OFS.Folder, OFS.SimpleItem
-from AccessControl import SecurityManager
-from AccessControl.SecurityManagement import newSecurityManager
-import Acquisition
-from DateTime import DateTime
-from Products.CMFCore.TypesTool import TypesTool, FactoryTypeInformation
-from Products.CMFCore.CatalogTool import CatalogTool
-from Products.CMFCore.PortalContent import PortalContent
-from Products.CMFCore.PortalFolder import *
-
-class UnitTestSecurityPolicy:
-    """
-        Stub out the existing security policy for unit testing purposes.
-    """
-    #
-    #   Standard SecurityPolicy interface
-    #
-    def validate( self
-                , accessed=None
-                , container=None
-                , name=None
-                , value=None
-                , context=None
-                , roles=None
-                , *args
-                , **kw):
-        return 1
-    
-    def checkPermission( self, permission, object, context) :
-        return 1
-
-class UnitTestUser( Acquisition.Implicit ):
-    """
-        Stubbed out manager for unit testing purposes.
-    """
-    def getId( self ):
-        return 'unit_tester'
-    
-    getUserName = getId
-
-    def allowed( self, object, object_roles=None ):
-        return 1
+from unittest import TestCase, TestSuite, makeSuite, main
 
-class DummyContent( PortalContent, OFS.SimpleItem.Item ):
-    """
-    """
-    meta_type = 'Dummy'
-    after_add_called = before_delete_called = 0
-
-    def __init__( self, id, catalog=0 ):
-        self.id = id
-        self.reset()
-        self.catalog = catalog
-
-    def manage_afterAdd( self, item, container ):
-        self.after_add_called = 1
-        if self.catalog:
-            PortalContent.manage_afterAdd( self, item, container )
-
-    def manage_beforeDelete( self, item, container ):
-        self.before_delete_called = 1
-        if self.catalog:
-            PortalContent.manage_beforeDelete( self, item, container )
-    
-    def reset( self ):
-        self.after_add_called = self.before_delete_called = 0
+from Products.CMFCore.tests.base.dummy import \
+     DummyContent, DummyFTI
 
-    # WAAAAAAAAA!  we don't want the Database export/import crap in the way.
-    def _getCopy( self, container ):
-        return DummyContent( self.id, self.catalog )
+from Products.CMFCore.tests.base.testcase import \
+     SecurityTest
 
+from Products.CMFCore.tests.base.utils import \
+     has_path
 
+from DateTime import DateTime
+from Products.CMFCore.TypesTool import\
+     TypesTool,FactoryTypeInformation as FTI
+from Products.CMFCore.CatalogTool import CatalogTool
+from Products.CMFCore.PortalFolder import PortalFolder, ContentFilter
 
 def extra_meta_types():
     return [  { 'name' : 'Dummy', 'action' : 'manage_addFolder' } ]
 
-class PortalFolderTests( unittest.TestCase ):
+class PortalFolderTests( SecurityTest ):
 
     def setUp( self ):
-        get_transaction().begin()
-        self._policy = UnitTestSecurityPolicy()
-        self._oldPolicy = SecurityManager.setSecurityPolicy(self._policy)
-        self.connection = Zope.DB.open()
-        self.root = root = self.connection.root()[ 'Application' ]
-        newSecurityManager( None, UnitTestUser().__of__( self.root ) )
+        SecurityTest.setUp(self)
+
+        root = self.root
         try: root._delObject('test')
         except AttributeError: pass
         root._setObject( 'test', PortalFolder( 'test','' ) )
     
-    def tearDown( self ):
-        get_transaction().abort()
-        self.connection.close()
-        SecurityManager.setSecurityPolicy( self._oldPolicy )
-        
-
     def test_deletePropagation( self ):
 
         test = self.root.test
@@ -144,7 +77,7 @@
         catalog = self.root.portal_catalog
         assert len( catalog ) == 0
 
-        test._setObject( 'foo', DummyContent( 'foo' , 1 ) )
+        test._setObject( 'foo', DummyContent( 'foo' , catalog=1 ) )
         foo = test.foo
         assert foo.after_add_called
         assert not foo.before_delete_called
@@ -175,7 +108,7 @@
         test._setObject( 'sub', PortalFolder( 'sub', '' ) )
         sub = test.sub
 
-        sub._setObject( 'foo', DummyContent( 'foo', 1 ) )
+        sub._setObject( 'foo', DummyContent( 'foo', catalog=1 ) )
         foo = sub.foo
 
         assert foo.after_add_called
@@ -207,7 +140,7 @@
         folder._setObject( 'sub', PortalFolder( 'sub', '' ) )
         sub = folder.sub
 
-        sub._setObject( 'foo', DummyContent( 'foo', 1 ) )
+        sub._setObject( 'foo', DummyContent( 'foo', catalog=1 ) )
         foo = sub.foo
         assert len( catalog ) == 1
         assert 'foo' in catalog.uniqueValuesFor( 'id' )
@@ -218,7 +151,7 @@
         assert len( catalog ) == 1
         assert has_path( catalog._catalog, '/test/folder/new_sub/foo' )
 
-        folder._setObject( 'bar', DummyContent( 'bar', 1 ) )
+        folder._setObject( 'bar', DummyContent( 'bar', catalog=1 ) )
         bar = folder.bar
         assert 'bar' in catalog.uniqueValuesFor( 'id' )
         assert len( catalog ) == 2
@@ -249,7 +182,6 @@
 
         self.root._setObject( 'portal_types', TypesTool() )
         types_tool = self.root.portal_types
-        FTI = FactoryTypeInformation
         types_tool._setObject( 'Folder'
                              , FTI( id='Folder'
                                   , meta_type=PortalFolder.meta_type
@@ -307,14 +239,7 @@
 
         self.root._setObject( 'portal_types', TypesTool() )
         types_tool = self.root.portal_types
-        FTI = FactoryTypeInformation
-        types_tool._setObject( 'Dummy'
-                             , FTI( 'Dummy'
-                                  , meta_type=DummyContent.meta_type
-                                  , product='OFSP'
-                                  , factory='addDTMLDocument'
-                                  )
-                             )
+        types_tool._setObject( 'Dummy', DummyFTI )
 
         self.root._setObject( 'portal_catalog', CatalogTool() )
         catalog = self.root.portal_catalog
@@ -329,7 +254,7 @@
         test._setObject( 'sub3', PortalFolder( 'sub3', '' ) )
         sub3 = test.sub3
 
-        sub1._setObject( 'dummy', DummyContent( 'dummy', 1 ) )
+        sub1._setObject( 'dummy', DummyContent( 'dummy', catalog=1 ) )
         assert 'dummy' in sub1.objectIds()
         assert 'dummy' in sub1.contentIds()
         assert not 'dummy' in sub2.objectIds()
@@ -373,118 +298,43 @@
         assert has_path( catalog._catalog, '/test/sub2/dummy' )
         assert has_path( catalog._catalog, '/test/sub3/dummy' )
 
-
-def has_path( catalog, path ):
-    """
-        Verify that catalog has an object at path.
-    """
-    rids = map( lambda x: x.data_record_id_, catalog.searchResults() )
-    for rid in rids:
-        if catalog.getpath( rid ) == path:
-            return 1
-    return 0
-
-class LimitedUnitTestUser( Acquisition.Implicit ):
-    """
-        Stubbed out mmember for unit testing purposes.
-    """
-    def getId( self ):
-        return 'unit_test_member'
-    
-    getUserName = getId
-
-    def allowed( self, object, object_roles=None ):
-        if object_roles is None:
-            object_roles = ()
-        return 'Member' in object_roles
-
-class PortalFolderPermissionTests( unittest.TestCase ):
+class ContentFilterTests( TestCase ):
 
     def setUp( self ):
-        get_transaction().begin()
-        self._policy = UnitTestSecurityPolicy()
-        self._oldPolicy = SecurityManager.setSecurityPolicy(self._policy)
-        self.connection = Zope.DB.open()
-        self.root = self.connection.root()[ 'Application' ]
-        self.manager = UnitTestUser().__of__( self.root )
-        self.member = LimitedUnitTestUser().__of__( self.root )
-        self.root._setObject( 'folder', PortalFolder( 'folder', '' ) )
-        self.folder = self.root.folder
-        self.folder._setObject( 'doc1', DummyContent( 'doc1' ) )
-        self.folder._setObject( 'doc2', DummyContent( 'doc2' ) )
-        self.folder._setObject( 'doc3', DummyContent( 'doc3' ) )
-    
-    def tearDown( self ):
-        get_transaction().abort()
-        self.connection.close()
-        SecurityManager.setSecurityPolicy( self._oldPolicy )
-
-    def test_listFolderContentsPerms( self ):
-        pass
-
-class DummyContentWithMetadata( DummyContent ):
-
-    def Title( self ):
-        return self.title
-
-    def Creator( self ):
-        return self.creator
-
-    def Subject( self ):
-        return self.subject
-
-    def Description( self ):
-        return self.description
-
-    def created( self ):
-        return self.created_date
-
-    def modified( self ):
-        return self.modified_date
-    
-    def Type( self ):
-        return 'Dummy Content'
-
-class ContentFilterTests( unittest.TestCase ):
-
-    def setUp( self ):
-        get_transaction().begin()
-
-    def tearDown( self ):
-        get_transaction().abort()
+        self.dummy=DummyContent('Dummy')
 
     def test_empty( self ):
         cfilter = ContentFilter()
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = filter( None, string.split( desc, '; ' ) )
+        lines = filter( None, desc.split('; ') )
         assert not lines
 
     def test_Type( self ):
         cfilter = ContentFilter( Type='foo' )
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         cfilter = ContentFilter( Type='Dummy Content' )
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 1
         assert lines[0] == 'Type: Dummy Content'
 
         cfilter = ContentFilter( Type=( 'foo', 'bar' ) )
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         cfilter = ContentFilter( Type=( 'Dummy Content', 'something else' ) )
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 1
         assert lines[0] == 'Type: Dummy Content, something else'
 
     def test_Title( self ):
         cfilter = ContentFilter( Title='foo' )
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         dummy.title = 'asdf'
         assert not cfilter( dummy )
@@ -493,28 +343,28 @@
         dummy.title = 'ohsofoolish'
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 1
         assert lines[0] == 'Title: foo'
     
     def test_Creator( self ):
         cfilter = ContentFilter( Creator='moe' )
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         dummy.creator = 'curly'
         assert not cfilter( dummy )
         dummy.creator = 'moe'
-        assert cfilter( dummy )
+        self.failUnless(cfilter( dummy ))
         dummy.creator = 'shmoe'
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
-        assert len( lines ) == 1
-        assert lines[0] == 'Creator: moe'
+        lines = desc.split('; ')
+        self.assertEqual(len( lines ),1)
+        self.assertEqual(lines[0],'Creator: moe')
     
     def test_Description( self ):
         cfilter = ContentFilter( Description='funny' )
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         dummy.description = 'sad'
         assert not cfilter( dummy )
@@ -523,13 +373,13 @@
         dummy.description = 'it is funny you should mention it...'
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 1
         assert lines[0] == 'Description: funny'
     
     def test_Subject( self ):
         cfilter = ContentFilter( Subject=('foo',) )
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         dummy.subject = ( 'bar', )
         assert not cfilter( dummy )
@@ -538,13 +388,14 @@
         dummy.subject = ( 'foo', 'bar', )
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 1
         assert lines[0] == 'Subject: foo'
 
+    def test_Subject2( self ):
         # Now test with mutli-valued
         cfilter = ContentFilter( Subject=('foo', 'bar' ) )
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         dummy.subject = ( 'baz', )
         assert not cfilter( dummy )
@@ -555,14 +406,14 @@
         dummy.subject = ( 'foo', 'bar', )
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 1
         assert lines[0] == 'Subject: foo, bar'
     
     def test_created( self ):
         cfilter = ContentFilter( created=DateTime( '2001/01/01' )
                                , created_usage='range:min' )
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         dummy.created_date = DateTime( '2000/12/31' )
         assert not cfilter( dummy )
@@ -571,14 +422,16 @@
         dummy.created_date = DateTime( '2001/01/01' )
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 1
         assert lines[0] == 'Created since: 2001/01/01'
 
+    def test_created2( self ):
+        
         cfilter = ContentFilter( created=DateTime( '2001/01/01' )
                                , created_usage='range:max' )
 
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         dummy.created_date = DateTime( '2000/12/31' )
         assert cfilter( dummy )
@@ -587,14 +440,14 @@
         dummy.created_date = DateTime( '2001/01/01' )
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 1
         assert lines[0] == 'Created before: 2001/01/01'
     
     def test_modified( self ):
         cfilter = ContentFilter( modified=DateTime( '2001/01/01' )
                                , modified_usage='range:min' )
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         dummy.modified_date = DateTime( '2000/12/31' )
         assert not cfilter( dummy )
@@ -603,14 +456,14 @@
         dummy.modified_date = DateTime( '2001/01/01' )
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 1
         assert lines[0] == 'Modified since: 2001/01/01'
 
+    def test_modified2( self ):
         cfilter = ContentFilter( modified=DateTime( '2001/01/01' )
-                               , modified_usage='range:max' )
-
-        dummy = DummyContentWithMetadata( 'Dummy' )
+                               , modified_usage='range:max' )        
+        dummy = self.dummy
         assert not cfilter( dummy )
         dummy.modified_date = DateTime( '2000/12/31' )
         assert cfilter( dummy )
@@ -619,7 +472,7 @@
         dummy.modified_date = DateTime( '2001/01/01' )
         assert cfilter( dummy )
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 1
         assert lines[0] == 'Modified before: 2001/01/01'
  
@@ -629,7 +482,7 @@
                                , Title='foo'
                                )
 
-        dummy = DummyContentWithMetadata( 'Dummy' )
+        dummy = self.dummy
         assert not cfilter( dummy )
         dummy.created_date = DateTime( '2000/12/31' )
         assert not cfilter( dummy )
@@ -649,20 +502,16 @@
         assert cfilter( dummy )
 
         desc = str( cfilter )
-        lines = string.split( desc, '; ' )
+        lines = desc.split('; ')
         assert len( lines ) == 2, lines
         assert 'Created before: 2001/01/01' in lines
         assert 'Title: foo' in lines
 
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest( unittest.makeSuite( PortalFolderTests ) )
-    suite.addTest( unittest.makeSuite( PortalFolderPermissionTests ) )
-    suite.addTest( unittest.makeSuite( ContentFilterTests ) )
-    return suite
-
-def run():
-    unittest.TextTestRunner().run(test_suite())
+    return TestSuite((
+        makeSuite( PortalFolderTests ),
+        makeSuite( ContentFilterTests ),
+        ))
 
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')


=== CMF/CMFCore/tests/test_TypesTool.py 1.12 => 1.13 ===
-import OFS.Folder, OFS.SimpleItem
 from unittest import TestCase, TestSuite, makeSuite, main
-from Acquisition import Implicit
+
+from Products.CMFCore.TypesTool import\
+     FactoryTypeInformation as FTI,\
+     ScriptableTypeInformation as STI,\
+     TypesTool,addTypeFactory,Unauthorized
+
+from Products.CMFCore.PortalFolder import PortalFolder
+from Products.CMFCore.utils import _getViewFor
+
+from Products.CMFCore.tests.base.testcase import \
+     SecurityRequestTest
+from Products.CMFCore.tests.base.security import \
+     OmnipotentUser, UserWithRoles
+from Products.CMFCore.tests.base.dummy import \
+     DummyObject, addDummy, DummyTypeInfo,\
+     DummyFolder, DummyFTI
+
 from AccessControl.SecurityManagement import newSecurityManager
 from AccessControl.SecurityManagement import noSecurityManager
-from AccessControl import SecurityManager
-from Products.CMFCore.TypesTool import *
-from Products.CMFCore.PortalContent import PortalContent
-from Products.CMFCore.CMFCorePermissions import AddPortalContent
-from Products.CMFCore.CMFCorePermissions import ModifyPortalContent
-from Products.CMFCore.PortalFolder import *
-from Products.CMFCore import utils
-import ZPublisher.HTTPRequest
+
 from Products.PythonScripts.standard import url_quote
 from webdav.NullResource import NullResource
 from Acquisition import aq_base
 
-class PermissiveSecurityPolicy:
-    """
-        Stub out the existing security policy for unit testing purposes.
-    """
-    #
-    #   Standard SecurityPolicy interface
-    #
-    def validate( self
-                , accessed=None
-                , container=None
-                , name=None
-                , value=None
-                , context=None
-                , roles=None
-                , *args
-                , **kw):
-        return 1
-    
-    def checkPermission( self, permission, object, context) :
-        if permission == 'forbidden permission':
-            return 0
-        return 1
-
-class OmnipotentUser( Implicit ):
-    """
-        Stubbed out manager for unit testing purposes.
-    """
-    def getId( self ):
-        return 'all_powerful_Oz'
-    
-    getUserName = getId
-
-    def allowed( self, object, object_roles=None ):
-        return 1
-
-class UserWithRoles( Implicit ):
-    """
-        Stubbed out manager for unit testing purposes.
-    """
-    def __init__( self, *roles ):
-        self._roles = roles
-
-    def getId( self ):
-        return 'high_roller'
-    
-    getUserName = getId
-
-    def allowed( self, object, object_roles=None ):
-        for orole in object_roles:
-            if orole in self._roles:
-                return 1
-        return 0
-
-class UnitTestUser( Implicit ):
-    """
-        Stubbed out manager for unit testing purposes.
-    """
-    def getId( self ):
-        return 'unit_tester'
-    
-    getUserName = getId
-
-    def has_permission(self, permission, obj):
-        # For types tool tests dealing with filtered_meta_types
-        return 1
-
-    def allowed( self, object, object_roles=None ):
-        # for testing permissions on actions
-        if object.getId() == 'actions_dummy':
-            if 'Anonymous' in object_roles:
-                return 1
-            else:
-                return 0
-        return 1
-
-class DummyMethod:
-    def __init__(self, name):
-        self.name = name
-    def __str__(self):
-        return self.name
-    def __call__(self):
-        return self.name
-
-class DummyContent( PortalContent, OFS.SimpleItem.Item ):
-    """
-    """
-    meta_type = 'Dummy'
-
-def addDummy( self, id ):
-    """
-    """
-    self._setObject( id, DummyContent() )
-
-def extra_meta_types():
-    return (  { 'name' : 'Dummy', 'action' : 'manage_addFolder' }, )
-
-class DummyTypeInfo(TypeInformation):
-    """ new class of type info object """
-    meta_type = "Dummy Test Type Info"
-
-class TypesToolTests( TestCase ):
+class TypesToolTests( SecurityRequestTest ):
 
     def setUp( self ):
-        get_transaction().begin()
-        self._policy = PermissiveSecurityPolicy()
-        self._oldPolicy = SecurityManager.setSecurityPolicy(self._policy)
-        self.connection = Zope.DB.open()
-        root = self.root = self.connection.root()[ 'Application' ]
-        newSecurityManager( None, UnitTestUser().__of__( self.root ) )
-
-        env = { 'SERVER_NAME' : 'http://localhost'
-              , 'SERVER_PORT' : '80'
-              }
-        root.REQUEST = ZPublisher.HTTPRequest.HTTPRequest( None, env, None )
-        
+        SecurityRequestTest.setUp(self)
+        root = self.root
         root.addDummy = addDummy
 
         root._setObject( 'portal_types', TypesTool() )
         tool = root.portal_types
-        FTI = FactoryTypeInformation
-        tool._setObject( 'Dummy'
-                       , FTI( 'Dummy'
-                            , meta_type=DummyContent.meta_type
-                            , product='CMFDefault'
-                            , factory='addDocument'
-                            , actions= ( { 'name'          : 'View'
-                                           , 'action'        : 'view'
-                                           , 'permissions'   : ('View', ) },
-                                         { 'name'          : 'View2'
-                                           , 'action'        : 'view2'
-                                           , 'permissions'   : ('View', ) },
-                                         { 'name'          : 'Edit'
-                                           , 'action'        : 'edit'
-                                           , 'permissions'   : ('forbidden permission',)
-                                           }
-                                         )
-                              )
-                         )
+        tool._setObject( 'Dummy', DummyFTI ) 
     
-    def tearDown( self ):
-        get_transaction().abort()
-        self.connection.close()
-        noSecurityManager()
-        SecurityManager.setSecurityPolicy(self._oldPolicy)
-
-    def off_test_otherFolderTypes( self ):
-        """
-            Does 'invokeFactory' work when invoked from non-PortalFolder?
-            Currently tests a bug which hasn't been fixed (remove 'off_'
-            from name to activate)            
-        """
-        self.root._setObject( 'portal', PortalFolder( 'portal', '' ) )
-        portal = self.root.portal
-        portal._setObject( 'normal', OFS.Folder.Folder( 'normal', '' ) )
-        normal = portal.normal
-        normal.invokeFactory( 'Dummy', 'dummy' )
-        assert 'dummy' not in portal.objectIds()
-        assert 'dummy' in normal.objectIds()
-
     def test_processActions( self ):
         """
         Are the correct, permitted methods returned for actions?
@@ -185,13 +45,13 @@
         dummy = portal._getOb( 'actions_dummy' )
 
         # so we can traverse to it:
-        dummy.view = DummyMethod("view")
-        dummy.view2 = DummyMethod("view2")
-        dummy.edit = DummyMethod("edit")
+        dummy.view = DummyObject("view")
+        dummy.view2 = DummyObject("view2")
+        dummy.edit = DummyObject("edit")
 
         default_view = dummy()
-        custom_view = utils._getViewFor( dummy, view='view2' )()
-        unpermitted_view = utils._getViewFor( dummy, view='edit' )()
+        custom_view = _getViewFor( dummy, view='view2' )()
+        unpermitted_view = _getViewFor( dummy, view='edit' )()
 
         self.failUnlessEqual(default_view, 'view')
         self.failUnlessEqual(custom_view, 'view2')
@@ -214,7 +74,7 @@
 
         tool.manage_addTypeInformation(id='foo_default', type_type=None)
         fd = tool.foo_default
-        self.failUnless(isinstance(fd, FactoryTypeInformation))
+        self.failUnless(isinstance(fd, FTI))
         self.failIf(isinstance(fd, DummyTypeInfo))
 
         tool.manage_addTypeInformation(id='foo_sub', type_type=type_type)
@@ -400,7 +260,7 @@
 class FTIDataTests( TypeInfoTests ):
 
     def _makeInstance( self, id, **kw ):
-        return apply( FactoryTypeInformation, ( id, ), kw )
+        return apply( FTI, ( id, ), kw )
 
     def test_properties( self ):
         ti = self._makeInstance( 'Foo' )
@@ -418,7 +278,7 @@
 class STIDataTests( TypeInfoTests ):
 
     def _makeInstance( self, id, **kw ):
-        return apply( ScriptableTypeInformation, ( id, ), kw )
+        return apply( STI, ( id, ), kw )
 
     def test_properties( self ):
         ti = self._makeInstance( 'Foo' )
@@ -432,63 +292,16 @@
         self.assertEqual( ti.permission, 'Add Foos' )
         self.assertEqual( ti.constructor_path, 'foo_add' )
 
-
-class Foo:
-    """
-        Shim content object.
-    """
-    def __init__( self, id, *args, **kw ):
-        self.id = id
-        self._args = args
-        self._kw = {}
-        self._kw.update( kw )
-
-class FauxFactory:
-    """
-        Shim product factory.
-    """
-    def __init__( self, folder ):
-        self._folder = folder
-
-    def addFoo( self, id, *args, **kw ):
-        if self._folder._prefix:
-            id = '%s_%s' % ( self._folder._prefix, id )
-        foo = apply( Foo, ( id, ) + args, kw )
-        self._folder._setOb( id, foo )
-        if self._folder._prefix:
-            return id
-
-    __roles__ = ( 'FooAdder', )
-    __allow_access_to_unprotected_subobjects__ = { 'addFoo' : 1 }
-
-class FauxFolder( Implicit ):
-    """
-        Shim container
-    """
-    def __init__( self, fake_product=0, prefix='' ):
-        self._prefix = prefix
-
-        if fake_product:
-            self.manage_addProduct = { 'FooProduct' : FauxFactory( self ) }
-
-        self._objects = {}
-
-    def _setOb( self, id, obj ):
-        self._objects[id] = obj
-
-    def _getOb( self, id ):
-        return self._objects[id]
-
 class FTIConstructionTests( TestCase ):
 
     def setUp( self ):
         noSecurityManager()
 
     def _makeInstance( self, id, **kw ):
-        return apply( FactoryTypeInformation, ( id, ), kw )
+        return apply( FTI, ( id, ), kw )
 
     def _makeFolder( self, fake_product=0 ):
-        return FauxFolder( fake_product )
+        return DummyFolder( fake_product )
 
     def test_isConstructionAllowed_wo_Container( self ):
 
@@ -537,11 +350,11 @@
 
     def _makeStuff( self, prefix='' ):
 
-        ti = FactoryTypeInformation( 'Foo'
-                                   , product='FooProduct'
-                                   , factory='addFoo'
-                                   )
-        folder = FauxFolder( fake_product=1, prefix=prefix )
+        ti = FTI( 'Foo'
+                  , product='FooProduct'
+                  , factory='addFoo'
+                  )
+        folder = DummyFolder( fake_product=1,prefix=prefix )
         
         return ti, folder
 
@@ -634,8 +447,5 @@
         makeSuite(FTIConstructionTests_w_Roles),
         ))
 
-def run():
-    main(defaultTest='test_suite')
-
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')


=== CMF/CMFCore/tests/test_all.py 1.13 => 1.14 ===
-from unittest import TestSuite, main
-from sys import modules
+from unittest import main
+from Products.CMFCore.tests.base.utils import build_test_suite
+
 def test_suite():
-    suite = TestSuite()
-    for name in [
+
+    return build_test_suite('Products.CMFCore.tests',[
         'test_ContentTypeRegistry',
         'test_PortalFolder',
         'test_TypesTool',
@@ -15,15 +16,7 @@
         'test_DirectoryView',
         'test_FSPythonScript',
         'test_FSPageTemplate'
-        ]:
-        __import__('Products.CMFCore.tests.'+name,globals(),locals())
-        suite.addTest(
-            modules['Products.CMFCore.tests.'+name].test_suite()
-            )
-    return suite
-
-def run():
-    main(defaultTest='test_suite')
+        ])
 
 if __name__ == '__main__':
-    run()
+    main(defaultTest='test_suite')