[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/tests - testZSP.py:1.1.2.2
Tres Seaver
tseaver@zope.com
Wed, 28 Nov 2001 15:59:26 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv8843/tests
Modified Files:
Tag: Zope-3x-branch
testZSP.py
Log Message:
- Remove a YAGNI violation (stubbed out placeful role lookup).
- Add note about an (apparent) OnceAndOnlyOnce violation.
=== Zope3/lib/python/Zope/App/Security/tests/testZSP.py 1.1.2.1 => 1.1.2.2 ===
def testListRolesFor( self ):
- policy = self._makePolicy()
-
- foo = Protected( 'foo' )
- bar = Unprotected()
-
- self.assertEqual( policy._listRolesFor( 'foo', foo ), () )
- self.assertEqual( policy._listRolesFor( 'foo', bar ), () )
-
- # TODO: test placeful role-permission mappings.
-
- def testAggregatedRolesFor( self ):
-
from Zope.App.Security.PermissionRegistry import definePermission
+ from Zope.App.Security.PermissionRegistry import defineRole
policy = self._makePolicy()
@@ -70,4 +59,10 @@
foo = Protected( 'foo' )
bar = Unprotected()
- self.assertEqual( policy._listAggregatedRolesFor( 'foo', foo ), () )
+ self.assertEqual( policy._listRolesFor( 'foo', foo ), () )
+
+ role = defineRole( 'Everyman' )
+ role.includePermission( 'foo' )
+
+ self.assertEqual( policy._listRolesFor( 'foo', foo )
+ , ( 'Everyman', ) )