[CMF-checkins] CVS: CMF/CMFSetup/tests - conformance.py:1.4
test_registry.py:1.12
Tres Seaver
tseaver at zope.com
Thu Jul 1 14:41:54 EDT 2004
Update of /cvs-repository/CMF/CMFSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv23575/tests
Modified Files:
conformance.py test_registry.py
Log Message:
- Add a global 'profile_registry', to allow third-party products to
register profiles.
=== CMF/CMFSetup/tests/conformance.py 1.3 => 1.4 ===
--- CMF/CMFSetup/tests/conformance.py:1.3 Wed Jun 30 14:13:00 2004
+++ CMF/CMFSetup/tests/conformance.py Thu Jul 1 14:41:53 2004
@@ -69,6 +69,15 @@
verifyClass( IToolsetRegistry, self._getTargetClass() )
+class ConformsToIProfileRegistry:
+
+ def test_IProfileRegistry_conformance( self ):
+
+ from Products.CMFSetup.interfaces import IProfileRegistry
+ from Interface.Verify import verifyClass
+
+ verifyClass( IProfileRegistry, self._getTargetClass() )
+
class ConformsToISetupTool:
def test_ISetupTool_conformance( self ):
=== CMF/CMFSetup/tests/test_registry.py 1.11 => 1.12 ===
--- CMF/CMFSetup/tests/test_registry.py:1.11 Wed Jun 30 14:13:00 2004
+++ CMF/CMFSetup/tests/test_registry.py Thu Jul 1 14:41:53 2004
@@ -12,6 +12,7 @@
from conformance import ConformsToIImportStepRegistry
from conformance import ConformsToIExportStepRegistry
from conformance import ConformsToIToolsetRegistry
+from conformance import ConformsToIProfileRegistry
#==============================================================================
# Dummy handlers
@@ -1002,12 +1003,62 @@
</tool-setup>
"""
+class ProfileRegistryTests( BaseRegistryTests
+ , ConformsToIProfileRegistry
+ ):
+
+ def _getTargetClass( self ):
+
+ from Products.CMFSetup.registry import ProfileRegistry
+ return ProfileRegistry
+
+ def test_empty( self ):
+
+ registry = self._makeOne()
+
+ self.assertEqual( len( registry.listProfiles() ), 0 )
+ self.assertEqual( len( registry.listProfiles() ), 0 )
+ self.assertRaises( KeyError, registry.getProfileInfo, 'nonesuch' )
+
+ def test_registerProfile_normal( self ):
+
+ PROFILE_ID = 'one'
+ TITLE = 'One'
+ DESCRIPTION = 'One profile'
+ PATH = '/path/to/one'
+
+ registry = self._makeOne()
+ registry.registerProfile( PROFILE_ID, TITLE, DESCRIPTION, PATH )
+
+ self.assertEqual( len( registry.listProfiles() ), 1 )
+ self.assertEqual( len( registry.listProfileInfo() ), 1 )
+
+ info = registry.getProfileInfo( PROFILE_ID )
+
+ self.assertEqual( info[ 'id' ], PROFILE_ID )
+ self.assertEqual( info[ 'title' ], TITLE )
+ self.assertEqual( info[ 'description' ], DESCRIPTION )
+ self.assertEqual( info[ 'path' ], PATH )
+
+ def test_registerProfile_duplicate( self ):
+
+ PROFILE_ID = 'one'
+ TITLE = 'One'
+ DESCRIPTION = 'One profile'
+ PATH = '/path/to/one'
+
+ registry = self._makeOne()
+ registry.registerProfile( PROFILE_ID, TITLE, DESCRIPTION, PATH )
+ self.assertRaises( KeyError
+ , registry.registerProfile
+ , PROFILE_ID, TITLE, DESCRIPTION, PATH )
def test_suite():
return unittest.TestSuite((
unittest.makeSuite( ImportStepRegistryTests ),
unittest.makeSuite( ExportStepRegistryTests ),
unittest.makeSuite( ToolsetRegistryTests ),
+ unittest.makeSuite( ProfileRegistryTests ),
))
if __name__ == '__main__':
More information about the CMF-checkins
mailing list