[Zope-CVS] CVS: Products/PluggableAuthService/plugins/tests -
helpers.py:1.2 test_ZODBRoleManager.py:1.6
Tres Seaver
tseaver at palladion.com
Thu Sep 1 13:31:57 EDT 2005
Update of /cvs-repository/Products/PluggableAuthService/plugins/tests
In directory cvs.zope.org:/tmp/cvs-serv23816/plugins/tests
Modified Files:
helpers.py test_ZODBRoleManager.py
Log Message:
- Made ZODBRoleManager plugin check grants to the principal's groups,
as well as those made to the principal directly.
=== Products/PluggableAuthService/plugins/tests/helpers.py 1.1 => 1.2 ===
--- Products/PluggableAuthService/plugins/tests/helpers.py:1.1 Mon Aug 30 11:23:25 2004
+++ Products/PluggableAuthService/plugins/tests/helpers.py Thu Sep 1 13:31:56 2005
@@ -37,9 +37,13 @@
class DummyUser:
- def __init__( self, id ):
+ def __init__( self, id, groups=() ):
self._id = id
+ self._groups = groups
def getId( self ):
return self._id
+
+ def getGroups( self ):
+ return self._groups
=== Products/PluggableAuthService/plugins/tests/test_ZODBRoleManager.py 1.5 => 1.6 ===
--- Products/PluggableAuthService/plugins/tests/test_ZODBRoleManager.py:1.5 Mon Sep 13 11:14:46 2004
+++ Products/PluggableAuthService/plugins/tests/test_ZODBRoleManager.py Thu Sep 1 13:31:56 2005
@@ -283,6 +283,26 @@
self.failUnless( 'test1' in roles )
self.failUnless( 'test2' in roles )
+ def test_assignRoleToPrincipal_group( self ):
+
+ from Products.PluggableAuthService.tests.test_PluggableAuthService \
+ import FauxRoot
+
+ root = FauxRoot()
+ zrm = self._makeOne( id='assign_user' ).__of__( root )
+ zrm.addRole( 'test1' )
+ zrm.addRole( 'test2' )
+ user = DummyUser( 'foo', ( 'qux', ) )
+
+ roles = zrm.getRolesForPrincipal( user )
+ self.assertEqual( len( roles ), 0 )
+
+ zrm.assignRoleToPrincipal( 'test1', 'qux' )
+
+ roles = zrm.getRolesForPrincipal( user )
+ self.assertEqual( len( roles ), 1 )
+ self.failUnless( 'test1' in roles )
+
def test_assignRoleToPrincipal_new( self ):
root = FauxPAS()
@@ -458,4 +478,4 @@
return unittest.TestSuite((
unittest.makeSuite( ZODBRoleManagerTests ),
))
-
\ No newline at end of file
+
More information about the Zope-CVS
mailing list