Back to index

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

List of all members.

Public Member Functions

def test_listRoles_normal
def test_listRoles_added
def test_listPermissions_nooverrides
def test_listPermissions_acquire
def test_listPermissions_no_acquire
def test_generateXML_empty
def test_generateXML_added_role
def test_generateEXML_acquired_perm
def test_generateEXML_unacquired_perm
def test_generateEXML_unacquired_perm_added_role

Static Public Attributes

 layer = ExportImportZCMLLayer

Private Member Functions

def _getTargetClass

Detailed Description

Definition at line 29 of file test_rolemap.py.


Member Function Documentation

Definition at line 33 of file test_rolemap.py.

00033 
00034     def _getTargetClass( self ):
00035 
00036         from Products.GenericSetup.rolemap import RolemapExportConfigurator
00037         return RolemapExportConfigurator

Definition at line 128 of file test_rolemap.py.

00128 
00129     def test_generateEXML_acquired_perm( self ):
00130 
00131         ACI = 'Access contents information'
00132         ROLES = [ 'Manager', 'Owner' ]
00133 
00134         site = Folder(id='site').__of__(self.app)
00135         site.manage_permission( ACI, ROLES, acquire=1 )
00136         configurator = self._makeOne( site ).__of__( site )
00137 
00138         self._compareDOM( configurator.generateXML(), _ACQUIRED_EXPORT )

Definition at line 139 of file test_rolemap.py.

00139 
00140     def test_generateEXML_unacquired_perm( self ):
00141 
00142         ACI = 'Access contents information'
00143         ROLES = [ 'Manager', 'Owner', 'ZZZ' ]
00144 
00145         site = Folder(id='site').__of__(self.app)
00146         existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
00147         existing_roles.append( 'ZZZ' )
00148         site.__ac_roles__ = existing_roles
00149         site.manage_permission( ACI, ROLES )
00150         configurator = self._makeOne( site ).__of__( site )
00151 
00152         self._compareDOM( configurator.generateXML(), _COMBINED_EXPORT )

Definition at line 153 of file test_rolemap.py.

00153 
00154     def test_generateEXML_unacquired_perm_added_role( self ):
00155 
00156         ACI = 'Access contents information'
00157         ROLES = [ 'Manager', 'Owner' ]
00158 
00159         site = Folder(id='site').__of__(self.app)
00160         site.manage_permission( ACI, ROLES )
00161         configurator = self._makeOne( site ).__of__( site )
00162 
00163         self._compareDOM( configurator.generateXML(), _UNACQUIRED_EXPORT )
00164 

Definition at line 117 of file test_rolemap.py.

00117 
00118     def test_generateXML_added_role( self ):
00119 
00120         self.app.site = Folder(id='site')
00121         site = self.app.site
00122         existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
00123         existing_roles.append( 'ZZZ' )
00124         site.__ac_roles__ = existing_roles
00125         configurator = self._makeOne( site ).__of__( site )
00126 
00127         self._compareDOM( configurator.generateXML(), _ADDED_ROLE_EXPORT )

Definition at line 109 of file test_rolemap.py.

00109 
00110     def test_generateXML_empty( self ):
00111 
00112         self.app.site = Folder(id='site')
00113         site = self.app.site
00114         configurator = self._makeOne( site ).__of__( site )
00115 
00116         self._compareDOM( configurator.generateXML(), _EMPTY_EXPORT )

Definition at line 79 of file test_rolemap.py.

00079 
00080     def test_listPermissions_acquire( self ):
00081 
00082         ACI = 'Access contents information'
00083         ROLES = [ 'Manager', 'Owner' ]
00084 
00085         site = Folder(id='site').__of__(self.app)
00086         site.manage_permission( ACI, ROLES, acquire=1 )
00087         configurator = self._makeOne( site )
00088 
00089         self.assertEqual( len( configurator.listPermissions() ), 1 )
00090         info = configurator.listPermissions()[ 0 ]
00091         self.assertEqual( info[ 'name' ], ACI )
00092         self.assertEqual( info[ 'roles' ], ROLES )
00093         self.failUnless( info[ 'acquire' ] )

Definition at line 94 of file test_rolemap.py.

00094 
00095     def test_listPermissions_no_acquire( self ):
00096 
00097         ACI = 'Access contents information'
00098         ROLES = [ 'Manager', 'Owner' ]
00099 
00100         site = Folder(id='site').__of__(self.app)
00101         site.manage_permission( ACI, ROLES )
00102         configurator = self._makeOne( site )
00103 
00104         self.assertEqual( len( configurator.listPermissions() ), 1 )
00105         info = configurator.listPermissions()[ 0 ]
00106         self.assertEqual( info[ 'name' ], ACI )
00107         self.assertEqual( info[ 'roles' ], ROLES )
00108         self.failIf( info[ 'acquire' ] )

Definition at line 72 of file test_rolemap.py.

00072 
00073     def test_listPermissions_nooverrides( self ):
00074 
00075         site = Folder(id='site').__of__(self.app)
00076         configurator = self._makeOne( site )
00077 
00078         self.assertEqual( len( configurator.listPermissions() ), 0 )

Definition at line 53 of file test_rolemap.py.

00053 
00054     def test_listRoles_added( self ):
00055 
00056         EXPECTED = [ 'Anonymous', 'Authenticated', 'Manager', 'Owner', 'ZZZ' ]
00057         self.app.site = Folder(id='site')
00058         site = self.app.site
00059         existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
00060         existing_roles.append( 'ZZZ' )
00061         site.__ac_roles__ = existing_roles
00062 
00063         configurator = self._makeOne( site )
00064 
00065         roles = list( configurator.listRoles() )
00066         self.assertEqual( len( roles ), len( EXPECTED ) )
00067 
00068         roles.sort()
00069 
00070         for found, expected in zip( roles, EXPECTED ):
00071             self.assertEqual( found, expected )

Definition at line 38 of file test_rolemap.py.

00038 
00039     def test_listRoles_normal( self ):
00040 
00041         EXPECTED = [ 'Anonymous', 'Authenticated', 'Manager', 'Owner' ]
00042         self.app.site = Folder(id='site')
00043         site = self.app.site
00044         configurator = self._makeOne( site )
00045 
00046         roles = list( configurator.listRoles() )
00047         self.assertEqual( len( roles ), len( EXPECTED ) )
00048 
00049         roles.sort()
00050 
00051         for found, expected in zip( roles, EXPECTED ):
00052             self.assertEqual( found, expected )


Member Data Documentation

Definition at line 31 of file test_rolemap.py.


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