[CMF-checkins] CVS: CMF/CMFSetup/tests - test_registry.py:1.16
test_tool.py:1.17
Yvo Schubbe
y.2005- at wcm-solutions.de
Wed Mar 16 03:23:05 EST 2005
Update of /cvs-repository/CMF/CMFSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv9332/CMFSetup/tests
Modified Files:
test_registry.py test_tool.py
Log Message:
Added support for extension profiles:
- added optional 'profile_type' argument to registerProfile()
- runImportStep() and runAllImportSteps() have now None as default for purge_old: None doesn't override the default purge behavior of the profile type
- by default the profile type controls the purge mode: removed checkbox for setting it manually on the 'Import' tab
- replaced _clear() by clear(): registry entries are now accumulated and only cleared by an explicit method call
- the factory and the siteAddForm now allow to specify extension profiles that are imported after the base profile
- duplicate settings no longer raise errors, the last setting always wins
=== CMF/CMFSetup/tests/test_registry.py 1.15 => 1.16 ===
--- CMF/CMFSetup/tests/test_registry.py:1.15 Thu Aug 12 11:07:41 2004
+++ CMF/CMFSetup/tests/test_registry.py Wed Mar 16 03:22:35 2005
@@ -22,6 +22,7 @@
from OFS.Folder import Folder
from Products.CMFSetup.tests.common import BaseRegistryTests
+from Products.CMFSetup import EXTENSION
from conformance import ConformsToIStepRegistry
from conformance import ConformsToIImportStepRegistry
@@ -182,12 +183,10 @@
, handler=ONE_FUNC
)
- self.assertRaises( KeyError
- , registry.registerStep
- , id='one'
- , version='1'
- , handler=ONE_FUNC
- )
+ registry.registerStep( id='one', version='1', handler=ONE_FUNC )
+
+ info_list = registry.listStepMetadata()
+ self.assertEqual( len( info_list ), 1 )
def test_registerStep_replacement( self ):
@@ -682,7 +681,13 @@
registry = self._makeOne()
registry.registerStep( 'one', ONE_FUNC )
- self.assertRaises( KeyError, registry.registerStep, 'one', TWO_FUNC )
+ registry.registerStep( 'one', TWO_FUNC )
+ info = registry.getStepMetadata( 'one', {} )
+
+ self.assertEqual( info[ 'id' ], 'one' )
+ self.assertEqual( info[ 'handler' ], TWO_FUNC_NAME )
+ self.assertEqual( info[ 'title' ], 'one' )
+ self.assertEqual( info[ 'description' ], '' )
def test_generateXML_empty( self ):
@@ -873,8 +878,9 @@
configurator = self._makeOne().__of__( site )
configurator.addForbiddenTool( 'once' )
+ configurator.addForbiddenTool( 'once' )
- self.assertRaises( KeyError, configurator.addForbiddenTool, 'once' )
+ self.assertEqual( len( configurator.listForbiddenTools() ), 1 )
def test_addForbiddenTool_but_required( self ):
@@ -919,12 +925,11 @@
configurator = self._makeOne().__of__( site )
configurator.addRequiredTool( 'required', 'some.dotted.name' )
+ configurator.addRequiredTool( 'required', 'another.name' )
- self.assertRaises( KeyError
- , configurator.addRequiredTool
- , 'required'
- , 'another.name'
- )
+ info = configurator.getRequiredToolInfo( 'required' )
+ self.assertEqual( info[ 'id' ], 'required' )
+ self.assertEqual( info[ 'class' ], 'another.name' )
def test_addRequiredTool_but_forbidden( self ):
@@ -1043,6 +1048,7 @@
DESCRIPTION = 'One profile'
PATH = '/path/to/one'
PRODUCT = 'TestProduct'
+ PROFILE_TYPE = EXTENSION
registry = self._makeOne()
registry.registerProfile( PROFILE_ID
@@ -1050,6 +1056,7 @@
, DESCRIPTION
, PATH
, PRODUCT
+ , PROFILE_TYPE
)
self.assertEqual( len( registry.listProfiles() ), 1 )
@@ -1062,6 +1069,7 @@
self.assertEqual( info[ 'description' ], DESCRIPTION )
self.assertEqual( info[ 'path' ], PATH )
self.assertEqual( info[ 'product' ], PRODUCT )
+ self.assertEqual( info[ 'type' ], PROFILE_TYPE )
def test_registerProfile_duplicate( self ):
@@ -1075,6 +1083,7 @@
self.assertRaises( KeyError
, registry.registerProfile
, PROFILE_ID, TITLE, DESCRIPTION, PATH )
+
def test_suite():
return unittest.TestSuite((
=== CMF/CMFSetup/tests/test_tool.py 1.16 => 1.17 ===
--- CMF/CMFSetup/tests/test_tool.py:1.16 Thu Jan 20 14:00:19 2005
+++ CMF/CMFSetup/tests/test_tool.py Wed Mar 16 03:22:35 2005
@@ -48,7 +48,7 @@
FilesystemTestBase.setUp( self )
self._profile_registry_info = profile_registry._profile_info
self._profile_registry_ids = profile_registry._profile_ids
- profile_registry._clear()
+ profile_registry.clear()
def tearDown( self ):
@@ -145,6 +145,7 @@
from common import _makeTestFile
tool = self._makeOne()
+ tool.getExportStepRegistry().clear()
_makeTestFile( IMPORT_STEPS_XML
, self._PROFILE_PATH
More information about the CMF-checkins
mailing list