[CMF-checkins] CVS: CMF/CMFSetup/tests - conformance.py:1.6.2.1
test_registry.py:1.15.2.1 test_tool.py:1.15.2.2
Yvo Schubbe
y.2005- at wcm-solutions.de
Tue Apr 5 11:17:49 EDT 2005
Update of /cvs-repository/CMF/CMFSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv8223/CMFSetup/tests
Modified Files:
Tag: CMF-1_5-branch
conformance.py test_registry.py test_tool.py
Log Message:
backported recent CMFSetup changes from HEAD to CMF-1_5-branch
=== CMF/CMFSetup/tests/conformance.py 1.6 => 1.6.2.1 ===
--- CMF/CMFSetup/tests/conformance.py:1.6 Thu Aug 12 11:07:41 2004
+++ CMF/CMFSetup/tests/conformance.py Tue Apr 5 11:17:17 2005
@@ -94,7 +94,7 @@
def test_ISetupTool_conformance( self ):
- from Products.CMFSetup.tool import ISetupTool
+ from Products.CMFSetup.interfaces import ISetupTool
from Interface.Verify import verifyClass
verifyClass( ISetupTool, self._getTargetClass() )
=== CMF/CMFSetup/tests/test_registry.py 1.15 => 1.15.2.1 ===
--- CMF/CMFSetup/tests/test_registry.py:1.15 Thu Aug 12 11:07:41 2004
+++ CMF/CMFSetup/tests/test_registry.py Tue Apr 5 11:17:17 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 ):
@@ -1038,18 +1043,21 @@
def test_registerProfile_normal( self ):
- PROFILE_ID = 'one'
+ NAME = 'one'
TITLE = 'One'
DESCRIPTION = 'One profile'
PATH = '/path/to/one'
PRODUCT = 'TestProduct'
+ PROFILE_TYPE = EXTENSION
+ PROFILE_ID = 'TestProduct:one'
registry = self._makeOne()
- registry.registerProfile( PROFILE_ID
+ registry.registerProfile( NAME
, TITLE
, DESCRIPTION
, PATH
, PRODUCT
+ , PROFILE_TYPE
)
self.assertEqual( len( registry.listProfiles() ), 1 )
@@ -1062,6 +1070,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 +1084,7 @@
self.assertRaises( KeyError
, registry.registerProfile
, PROFILE_ID, TITLE, DESCRIPTION, PATH )
+
def test_suite():
return unittest.TestSuite((
=== CMF/CMFSetup/tests/test_tool.py 1.15.2.1 => 1.15.2.2 ===
--- CMF/CMFSetup/tests/test_tool.py:1.15.2.1 Thu Jan 20 13:59:36 2005
+++ CMF/CMFSetup/tests/test_tool.py Tue Apr 5 11:17:17 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 ):
@@ -120,9 +120,9 @@
)
profile_registry.registerProfile('foo', 'Foo', '', self._PROFILE_PATH)
- tool.setImportContext('profile-foo')
+ tool.setImportContext('profile-other:foo')
- self.assertEqual( tool.getImportContextID(), 'profile-foo' )
+ self.assertEqual( tool.getImportContextID(), 'profile-other:foo' )
def test_setImportContext_invalid( self ):
@@ -145,6 +145,7 @@
from common import _makeTestFile
tool = self._makeOne()
+ tool.getExportStepRegistry().clear()
_makeTestFile( IMPORT_STEPS_XML
, self._PROFILE_PATH
@@ -162,9 +163,9 @@
)
profile_registry.registerProfile('foo', 'Foo', '', self._PROFILE_PATH)
- tool.setImportContext('profile-foo')
+ tool.setImportContext('profile-other:foo')
- self.assertEqual( tool.getImportContextID(), 'profile-foo' )
+ self.assertEqual( tool.getImportContextID(), 'profile-other:foo' )
import_registry = tool.getImportStepRegistry()
self.assertEqual( len( import_registry.listSteps() ), 1 )
More information about the CMF-checkins
mailing list