[Zope3-checkins] CVS: Zope3/src/zope/app/security/tests -
mapping.zcml:1.2 principal.zcml:1.3 role.zcml:1.3
role_duplicate.zcml:1.3 test_securitydirectives.py:1.12
test_zopepolicy.py:1.17
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sun Dec 14 03:25:37 EST 2003
Update of /cvs-repository/Zope3/src/zope/app/security/tests
In directory cvs.zope.org:/tmp/cvs-serv1651/src/zope/app/security/tests
Modified Files:
mapping.zcml principal.zcml role.zcml role_duplicate.zcml
test_securitydirectives.py test_zopepolicy.py
Log Message:
I remember that we were too lazy after ZCMLgeddon to require the principal
and role ids to be Id fields, since it required many places to change.
While I was writing on the devel cookbook, I saw the metadirectives for the
security again and could not resist fixing it.
All tests pass now and Zope seems to run fine as well.
=== Zope3/src/zope/app/security/tests/mapping.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/security/tests/mapping.zcml:1.1 Sat Aug 2 16:05:43 2003
+++ Zope3/src/zope/app/security/tests/mapping.zcml Sun Dec 14 03:25:35 2003
@@ -4,15 +4,15 @@
<grant
permission="zope.Foo"
- role="Bar" />
+ role="zope.Bar" />
<grant
permission="zope.Foo"
- principal="Blah" />
+ principal="zope.Blah" />
<grant
- role="Bar"
- principal="Blah" />
+ role="zope.Bar"
+ principal="zope.Blah" />
</configure>
=== Zope3/src/zope/app/security/tests/principal.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/security/tests/principal.zcml:1.2 Sun Aug 3 15:08:41 2003
+++ Zope3/src/zope/app/security/tests/principal.zcml Sun Dec 14 03:25:35 2003
@@ -6,13 +6,13 @@
<include package="zope.app.security" file="meta.zcml"/>
<principal
- id="1"
+ id="zope.p1"
title="Sir Tim Peters"
description="Tim Peters"
login="tim" password="123" />
<principal
- id="2"
+ id="zope.p2"
title="Sir Jim Fulton"
description="Jim Fulton"
login="jim" password="123" />
=== Zope3/src/zope/app/security/tests/role.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/security/tests/role.zcml:1.2 Sun Aug 3 15:08:41 2003
+++ Zope3/src/zope/app/security/tests/role.zcml Sun Dec 14 03:25:35 2003
@@ -6,7 +6,7 @@
<include package="zope.app.security" file="meta.zcml"/>
<role
- id="Everyperson"
+ id="zope.Everyperson"
title="Tout le monde"
description="The common man, woman, person, or thing" />
=== Zope3/src/zope/app/security/tests/role_duplicate.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/security/tests/role_duplicate.zcml:1.2 Sun Aug 3 15:08:41 2003
+++ Zope3/src/zope/app/security/tests/role_duplicate.zcml Sun Dec 14 03:25:35 2003
@@ -5,12 +5,12 @@
<include package="zope.app.security" file="meta.zcml"/>
<role
- id="Everyperson"
+ id="zope.Everyperson"
title="Tout le monde"
description="The common man, woman, person, or thing" />
<role
- id="Everyperson"
+ id="zope.Everyperson"
title="Tout le monde"
description="The common man, woman, person, or thing" />
=== Zope3/src/zope/app/security/tests/test_securitydirectives.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/security/tests/test_securitydirectives.py:1.11 Sun Aug 17 02:08:09 2003
+++ Zope3/src/zope/app/security/tests/test_securitydirectives.py Sun Dec 14 03:25:35 2003
@@ -62,12 +62,12 @@
context = xmlconfig.file("principal.zcml", zope.app.security.tests)
reg=principalRegistry
- p = reg.getPrincipal('1')
- self.assertEqual(p.getId(), '1')
+ p = reg.getPrincipal('zope.p1')
+ self.assertEqual(p.getId(), 'zope.p1')
self.assertEqual(p.getTitle(), 'Sir Tim Peters')
self.assertEqual(p.getDescription(), 'Tim Peters')
- p = reg.getPrincipal('2')
- self.assertEqual(p.getId(), '2')
+ p = reg.getPrincipal('zope.p2')
+ self.assertEqual(p.getId(), 'zope.p2')
self.assertEqual(p.getTitle(), 'Sir Jim Fulton')
self.assertEqual(p.getDescription(), 'Jim Fulton')
@@ -94,7 +94,7 @@
def testRegister(self):
context = xmlconfig.file("role.zcml", zope.app.security.tests)
- role = rregistry.getRole("Everyperson")
+ role = rregistry.getRole("zope.Everyperson")
self.failUnless(role.getId().endswith('Everyperson'))
self.assertEqual(role.getTitle(), 'Tout le monde')
self.assertEqual(role.getDescription(),
@@ -110,39 +110,39 @@
def setUp(self):
TestBase.setUp(self)
pregistry.definePermission("zope.Foo", '', '')
- rregistry.defineRole("Bar", '', '')
- principalRegistry.definePrincipal("Blah", '', '')
+ rregistry.defineRole("zope.Bar", '', '')
+ principalRegistry.definePrincipal("zope.Blah", '', '')
self.context = xmlconfig.file("mapping.zcml", zope.app.security.tests)
def test_PermRoleMap(self):
roles = role_perm_mgr.getRolesForPermission("zope.Foo")
- perms = role_perm_mgr.getPermissionsForRole("Bar")
+ perms = role_perm_mgr.getPermissionsForRole("zope.Bar")
self.assertEqual(len(roles), 1)
- self.failUnless(("Bar",Allow) in roles)
+ self.failUnless(("zope.Bar",Allow) in roles)
self.assertEqual(len(perms), 1)
self.failUnless(("zope.Foo",Allow) in perms)
def test_PermPrincipalMap(self):
principals = principal_perm_mgr.getPrincipalsForPermission("zope.Foo")
- perms = principal_perm_mgr.getPermissionsForPrincipal("Blah")
+ perms = principal_perm_mgr.getPermissionsForPrincipal("zope.Blah")
self.assertEqual(len(principals), 1)
- self.failUnless(("Blah", Allow) in principals)
+ self.failUnless(("zope.Blah", Allow) in principals)
self.assertEqual(len(perms), 1)
self.failUnless(("zope.Foo", Allow) in perms)
def test_RolePrincipalMap(self):
- principals = principal_role_mgr.getPrincipalsForRole("Bar")
- roles = principal_role_mgr.getRolesForPrincipal("Blah")
+ principals = principal_role_mgr.getPrincipalsForRole("zope.Bar")
+ roles = principal_role_mgr.getRolesForPrincipal("zope.Blah")
self.assertEqual(len(principals), 1)
- self.failUnless(("Blah", Allow) in principals)
+ self.failUnless(("zope.Blah", Allow) in principals)
self.assertEqual(len(roles), 1)
- self.failUnless(("Bar", Allow) in roles)
+ self.failUnless(("zope.Bar", Allow) in roles)
def test_suite():
=== Zope3/src/zope/app/security/tests/test_zopepolicy.py 1.16 => 1.17 ===
--- Zope3/src/zope/app/security/tests/test_zopepolicy.py:1.16 Fri Nov 21 12:12:12 2003
+++ Zope3/src/zope/app/security/tests/test_zopepolicy.py Sun Dec 14 03:25:35 2003
@@ -11,10 +11,9 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
-
+"""Tests the standard zope policy.
-Revision information: $Id$
+$Id$
"""
import unittest
@@ -172,7 +171,8 @@
self.__assertPermissions(self.tim, ['read', 'write'])
self.__assertPermissions(self.unknown, [])
- rolePermissionManager.grantPermissionToRole(self.read, 'Anonymous')
+ rolePermissionManager.grantPermissionToRole(
+ self.read, 'zope.Anonymous')
self.failUnless(
self.policy.checkPermission(
@@ -260,7 +260,7 @@
test, self.jim.getId())
# Make sure multiple conflicting role permissions resolve correctly
- ARPM(ob2).grantPermissionToRole(test, 'Anonymous')
+ ARPM(ob2).grantPermissionToRole(test, 'zope.Anonymous')
ARPM(ob2).grantPermissionToRole(test, self.arole)
ARPM(ob3).denyPermissionToRole(test, self.peon)
More information about the Zope3-Checkins
mailing list