CVS: Products/PluggableAuthService/plugins/tests - helpers.py:1.2 test_ZODBRoleManager.py:1.6

Tres Seaver <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
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
+    

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.