Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions
GenericSetup.tests.test_rolemap.RolemapImportConfiguratorTests Class Reference
Inheritance diagram for GenericSetup.tests.test_rolemap.RolemapImportConfiguratorTests:
Inheritance graph
[legend]
Collaboration diagram for GenericSetup.tests.test_rolemap.RolemapImportConfiguratorTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_parseXML_empty
def test_parseXML_added_role
def test_parseXML_acquired_permission
def test_parseXML_unacquired_permission
def test_parseXML_unacquired_permission_added_role

Static Public Attributes

 layer = ExportImportZCMLLayer

Private Member Functions

def _getTargetClass

Detailed Description

Definition at line 165 of file test_rolemap.py.


Member Function Documentation

Definition at line 169 of file test_rolemap.py.

00169 
00170     def _getTargetClass( self ):
00171 
00172         from Products.GenericSetup.rolemap import RolemapImportConfigurator
00173         return RolemapImportConfigurator

Definition at line 202 of file test_rolemap.py.

00202 
00203     def test_parseXML_acquired_permission( self ):
00204 
00205         ACI = 'Access contents information'
00206 
00207         self.app.site = Folder(id='site')
00208         site = self.app.site
00209         configurator = self._makeOne( site )
00210 
00211         rolemap_info = configurator.parseXML( _ACQUIRED_EXPORT )
00212 
00213         self.assertEqual( len( rolemap_info[ 'permissions' ] ), 1 )
00214         permission = rolemap_info[ 'permissions' ][ 0 ]
00215 
00216         self.assertEqual( permission[ 'name' ], ACI )
00217         self.failUnless( permission[ 'acquire' ] )
00218 
00219         p_roles = permission[ 'roles' ]
00220         self.assertEqual( len( p_roles ), 2 )
00221         self.failUnless( 'Manager' in p_roles )
00222         self.failUnless( 'Owner' in p_roles )

Definition at line 186 of file test_rolemap.py.

00186 
00187     def test_parseXML_added_role( self ):
00188 
00189         self.app.site = Folder(id='site')
00190         site = self.app.site
00191         configurator = self._makeOne( site )
00192 
00193         rolemap_info = configurator.parseXML( _ADDED_ROLE_EXPORT )
00194         roles = rolemap_info[ 'roles' ]
00195 
00196         self.assertEqual( len( roles ), 5 )
00197         self.failUnless( 'Anonymous' in roles )
00198         self.failUnless( 'Authenticated' in roles )
00199         self.failUnless( 'Manager' in roles )
00200         self.failUnless( 'Owner' in roles )
00201         self.failUnless( 'ZZZ' in roles )

Definition at line 174 of file test_rolemap.py.

00174 
00175     def test_parseXML_empty( self ):
00176 
00177         self.app.site = Folder(id='site')
00178         site = self.app.site
00179         existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
00180         configurator = self._makeOne( site )
00181 
00182         rolemap_info = configurator.parseXML( _EMPTY_EXPORT )
00183 
00184         self.assertEqual( len( rolemap_info[ 'roles' ] ), 4 )
00185         self.assertEqual( len( rolemap_info[ 'permissions' ] ), 0 )

Definition at line 223 of file test_rolemap.py.

00223 
00224     def test_parseXML_unacquired_permission( self ):
00225 
00226         ACI = 'Access contents information'
00227 
00228         self.app.site = Folder(id='site')
00229         site = self.app.site
00230         configurator = self._makeOne( site )
00231 
00232         rolemap_info = configurator.parseXML( _UNACQUIRED_EXPORT )
00233 
00234         self.assertEqual( len( rolemap_info[ 'permissions' ] ), 1 )
00235         permission = rolemap_info[ 'permissions' ][ 0 ]
00236 
00237         self.assertEqual( permission[ 'name' ], ACI )
00238         self.failIf( permission[ 'acquire' ] )
00239 
00240         p_roles = permission[ 'roles' ]
00241         self.assertEqual( len( p_roles ), 2 )
00242         self.failUnless( 'Manager' in p_roles )
00243         self.failUnless( 'Owner' in p_roles )

Definition at line 244 of file test_rolemap.py.

00244 
00245     def test_parseXML_unacquired_permission_added_role( self ):
00246 
00247         ACI = 'Access contents information'
00248 
00249         self.app.site = Folder(id='site')
00250         site = self.app.site
00251         configurator = self._makeOne( site )
00252 
00253         rolemap_info = configurator.parseXML( _COMBINED_EXPORT )
00254         roles = rolemap_info[ 'roles' ]
00255 
00256         self.assertEqual( len( roles ), 5 )
00257         self.failUnless( 'Anonymous' in roles )
00258         self.failUnless( 'Authenticated' in roles )
00259         self.failUnless( 'Manager' in roles )
00260         self.failUnless( 'Owner' in roles )
00261         self.failUnless( 'ZZZ' in roles )
00262 
00263         self.assertEqual( len( rolemap_info[ 'permissions' ] ), 1 )
00264         permission = rolemap_info[ 'permissions' ][ 0 ]
00265 
00266         self.assertEqual( permission[ 'name' ], ACI )
00267         self.failIf( permission[ 'acquire' ] )
00268 
00269         p_roles = permission[ 'roles' ]
00270         self.assertEqual( len( p_roles ), 3 )
00271         self.failUnless( 'Manager' in p_roles )
00272         self.failUnless( 'Owner' in p_roles )
00273         self.failUnless( 'ZZZ' in p_roles )
00274 
00275 


Member Data Documentation

Definition at line 167 of file test_rolemap.py.


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