Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
PluggableAuthService.plugins.tests.test_RecursiveGroupsPlugin.RecursiveGroupsPluginTests Class Reference
Inheritance diagram for PluggableAuthService.plugins.tests.test_RecursiveGroupsPlugin.RecursiveGroupsPluginTests:
Inheritance graph
[legend]
Collaboration diagram for PluggableAuthService.plugins.tests.test_RecursiveGroupsPlugin.RecursiveGroupsPluginTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_simple_flattening
def test_complex_flattening
def test_cross_nested_flattening

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 82 of file test_RecursiveGroupsPlugin.py.


Member Function Documentation

Definition at line 84 of file test_RecursiveGroupsPlugin.py.

00084 
00085     def _getTargetClass( self ):
00086 
00087         from Products.PluggableAuthService.plugins.RecursiveGroupsPlugin \
00088             import RecursiveGroupsPlugin
00089 
00090         return RecursiveGroupsPlugin

Definition at line 91 of file test_RecursiveGroupsPlugin.py.

00091 
00092     def _makeOne( self, id='test', *args, **kw ):
00093 
00094         return self._getTargetClass()( id=id, *args, **kw )

Definition at line 119 of file test_RecursiveGroupsPlugin.py.

00119 
00120     def test_complex_flattening( self ):
00121         
00122         pas = FauxPAS()
00123         dgm = DummyGroupsManager( 'dummy' )
00124         odgm = DummyGroupsManager( 'other_dummy' )
00125         rgp = self._makeOne( 'rgp' )
00126 
00127         pas._setObject( 'dgm', dgm )
00128         pas._setObject( 'odgm', odgm )
00129         pas._setObject( 'rgp', rgp )
00130 
00131         dgm = pas._getOb( 'dgm' )
00132         dgm.addGroup( 'group1' )
00133         dgm.addGroup( 'group2' )
00134 
00135         odgm = pas._getOb( 'odgm' )
00136         odgm.addGroup( 'group3' )
00137         odgm.addGroup( 'group4' )
00138 
00139         rgp = pas._getOb( 'rgp' )
00140         
00141         user = DummyPrincipal( 'user1', ( 'dummy:group1'
00142                                         , 'other_dummy:group3' ) )
00143                 
00144         dgm.addPrincipalToGroup( user, 'group1' )
00145         dgm.addPrincipalToGroup( DummyPrincipal( 'dummy:group1' ), 'group2' )
00146 
00147         odgm.addPrincipalToGroup( user, 'group3' )
00148         odgm.addPrincipalToGroup( DummyPrincipal( 'dummy:group2' ), 'group4' )
00149         
00150         groups = rgp.getGroupsForPrincipal( user )
00151         self.assertEqual( len( groups ), 4 )
00152         self.failUnless( 'dummy:group1' in groups )
00153         self.failUnless( 'dummy:group2' in groups )
00154         self.failUnless( 'other_dummy:group3' in groups )
00155         self.failUnless( 'other_dummy:group4' in groups )

Definition at line 156 of file test_RecursiveGroupsPlugin.py.

00156 
00157     def test_cross_nested_flattening( self ):
00158         
00159         pas = FauxPAS()
00160         dgm = DummyGroupsManager( 'dummy' )
00161         odgm = DummyGroupsManager( 'other_dummy' )
00162         rgp = self._makeOne( 'rgp' )
00163 
00164         pas._setObject( 'dgm', dgm )
00165         pas._setObject( 'odgm', odgm )
00166         pas._setObject( 'rgp', rgp )
00167 
00168         dgm = pas._getOb( 'dgm' )
00169         dgm.addGroup( 'group1' )
00170 
00171         odgm = pas._getOb( 'odgm' )
00172         odgm.addGroup( 'group2' )
00173 
00174         rgp = pas._getOb( 'rgp' )
00175         
00176         user = DummyPrincipal( 'user1', ( 'dummy:group1'
00177                                         , 'other_dummy:group2' ) )
00178                 
00179         dgm.addPrincipalToGroup( user, 'group1' )
00180         dgm.addPrincipalToGroup( DummyPrincipal( 'other_dummy:group1' )
00181                                , 'group1' )
00182 
00183         odgm.addPrincipalToGroup( user, 'group2' )
00184         odgm.addPrincipalToGroup( DummyPrincipal( 'dummy:group1' ), 'group2' )
00185         
00186         groups = rgp.getGroupsForPrincipal( user )
00187         self.assertEqual( len( groups ), 2 )
00188         self.failUnless( 'dummy:group1' in groups )
00189         self.failUnless( 'other_dummy:group2' in groups )

Definition at line 95 of file test_RecursiveGroupsPlugin.py.

00095 
00096     def test_simple_flattening( self ):
00097         
00098         pas = FauxPAS()
00099         dgm = DummyGroupsManager( 'dummy' )
00100         rgp = self._makeOne( 'rgp' )
00101 
00102         pas._setObject( 'dgm', dgm )
00103         pas._setObject( 'rgp', rgp )
00104 
00105         dgm = pas._getOb( 'dgm' )
00106         dgm.addGroup( 'group1' )
00107         dgm.addGroup( 'group2' )
00108         
00109         rgp = pas._getOb( 'rgp' )
00110 
00111         user = DummyPrincipal( 'user1', ( 'dummy:group1', ) )
00112                 
00113         dgm.addPrincipalToGroup( user, 'group1' )
00114         dgm.addPrincipalToGroup( DummyPrincipal( 'dummy:group1' ), 'group2' )
00115         
00116         self.assertEqual( rgp.getGroupsForPrincipal( user )
00117                         , ( 'dummy:group1', 'dummy:group2' ) 
00118                         )


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