Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
GenericSetup.tests.test_registry.ProfileRegistryTests Class Reference
Inheritance diagram for GenericSetup.tests.test_registry.ProfileRegistryTests:
Inheritance graph
[legend]
Collaboration diagram for GenericSetup.tests.test_registry.ProfileRegistryTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_empty
def test_registerProfile_normal
def test_registerProfile_duplicate
def test_registerProfile_site_type

Private Member Functions

def _getTargetClass

Detailed Description

Definition at line 1017 of file test_registry.py.


Member Function Documentation

Definition at line 1019 of file test_registry.py.

01019 
01020     def _getTargetClass( self ):
01021 
01022         from Products.GenericSetup.registry import ProfileRegistry
01023         return ProfileRegistry

Definition at line 1024 of file test_registry.py.

01024 
01025     def test_empty( self ):
01026 
01027         registry = self._makeOne()
01028 
01029         self.assertEqual( len( registry.listProfiles() ), 0 )
01030         self.assertEqual( len( registry.listProfiles() ), 0 )
01031         self.assertRaises( KeyError, registry.getProfileInfo, 'nonesuch' )

Definition at line 1064 of file test_registry.py.

01064 
01065     def test_registerProfile_duplicate( self ):
01066 
01067         NAME = 'one'
01068         TITLE = 'One'
01069         DESCRIPTION = 'One profile'
01070         PATH = '/path/to/one'
01071 
01072         registry = self._makeOne()
01073         registry.registerProfile( NAME, TITLE, DESCRIPTION, PATH )
01074         self.assertRaises( KeyError
01075                          , registry.registerProfile
01076                          , NAME, TITLE, DESCRIPTION, PATH )
01077 

Definition at line 1032 of file test_registry.py.

01032 
01033     def test_registerProfile_normal( self ):
01034 
01035         NAME = 'one'
01036         TITLE = 'One'
01037         DESCRIPTION = 'One profile'
01038         PATH = '/path/to/one'
01039         PRODUCT = 'TestProduct'
01040         PROFILE_TYPE = EXTENSION
01041         PROFILE_ID = 'TestProduct:one'
01042 
01043         registry = self._makeOne()
01044         registry.registerProfile( NAME
01045                                 , TITLE
01046                                 , DESCRIPTION
01047                                 , PATH
01048                                 , PRODUCT
01049                                 , PROFILE_TYPE
01050                                 )
01051 
01052         self.assertEqual( len( registry.listProfiles() ), 1 )
01053         self.assertEqual( len( registry.listProfileInfo() ), 1 )
01054 
01055         info = registry.getProfileInfo( PROFILE_ID )
01056 
01057         self.assertEqual( info[ 'id' ], PROFILE_ID )
01058         self.assertEqual( info[ 'title' ], TITLE )
01059         self.assertEqual( info[ 'description' ], DESCRIPTION )
01060         self.assertEqual( info[ 'path' ], PATH )
01061         self.assertEqual( info[ 'product' ], PRODUCT )
01062         self.assertEqual( info[ 'type' ], PROFILE_TYPE )
01063         self.assertEqual( info[ 'for' ], None )

Definition at line 1078 of file test_registry.py.

01078 
01079     def test_registerProfile_site_type( self ):
01080 
01081         NAME = 'one'
01082         TITLE = 'One'
01083         DESCRIPTION = 'One profile'
01084         PATH = '/path/to/one'
01085         PRODUCT = 'TestProduct'
01086         PROFILE_ID = 'TestProduct:one'
01087         PROFILE_TYPE = EXTENSION
01088         FOR = ISite
01089         NOT_FOR = IAnotherSite
01090         DERIVED_FOR = IDerivedSite
01091 
01092         registry = self._makeOne()
01093         registry.registerProfile( NAME
01094                                 , TITLE
01095                                 , DESCRIPTION
01096                                 , PATH
01097                                 , PRODUCT
01098                                 , PROFILE_TYPE
01099                                 , for_=FOR
01100                                 )
01101 
01102 
01103         self.assertEqual( len( registry.listProfiles() ), 1 )
01104         self.assertEqual( len( registry.listProfiles( for_=FOR ) ), 1 )
01105         self.assertEqual( len( registry.listProfiles( for_=DERIVED_FOR ) )
01106                         , 1 )
01107         self.assertEqual( len( registry.listProfiles( for_=NOT_FOR ) )
01108                         , 0 )
01109 
01110         self.assertEqual( len( registry.listProfileInfo() ), 1 )
01111         self.assertEqual( len( registry.listProfileInfo( for_=FOR ) ), 1 )
01112         self.assertEqual( len( registry.listProfileInfo( for_=DERIVED_FOR ) )
01113                         , 1 )
01114         self.assertEqual( len( registry.listProfileInfo( for_=NOT_FOR ) )
01115                         , 0 )
01116 
01117         # Verify that these lookups succeed...
01118         info1 = registry.getProfileInfo( PROFILE_ID )
01119         info2 = registry.getProfileInfo( PROFILE_ID, for_=FOR )
01120         info3 = registry.getProfileInfo( PROFILE_ID, for_=DERIVED_FOR )
01121 
01122         self.assertEqual(info1, info2)
01123         self.assertEqual(info1, info3)
01124 
01125         # ...and that this one fails.
01126         self.assertRaises( KeyError
01127                          , registry.getProfileInfo
01128                          , PROFILE_ID
01129                          , for_=NOT_FOR
01130                          )
01131 
01132         info = registry.getProfileInfo( PROFILE_ID , for_=FOR )
01133 
01134         self.assertEqual( info[ 'id' ], PROFILE_ID )
01135         self.assertEqual( info[ 'title' ], TITLE )
01136         self.assertEqual( info[ 'description' ], DESCRIPTION )
01137         self.assertEqual( info[ 'path' ], PATH )
01138         self.assertEqual( info[ 'product' ], PRODUCT )
01139         self.assertEqual( info[ 'type' ], PROFILE_TYPE )
01140         self.assertEqual( info[ 'for' ], FOR )
01141 


The documentation for this class was generated from the following file: