[Zope-Checkins] CVS: Zope/lib/python/AccessControl/tests -
testZopeSecurityPolicy.py:1.7
Chris McDonough
cvs-admin at zope.org
Thu Oct 23 21:21:51 EDT 2003
Update of /cvs-repository/Zope/lib/python/AccessControl/tests
In directory cvs.zope.org:/tmp/cvs-serv23509/tests
Modified Files:
testZopeSecurityPolicy.py
Log Message:
Update AccessControl package to deal with various forms of Unicode and add some tests to make sure. This fixes Collector #1034.
=== Zope/lib/python/AccessControl/tests/testZopeSecurityPolicy.py 1.6 => 1.7 ===
--- Zope/lib/python/AccessControl/tests/testZopeSecurityPolicy.py:1.6 Tue Jun 10 11:39:04 2003
+++ Zope/lib/python/AccessControl/tests/testZopeSecurityPolicy.py Thu Oct 23 21:21:49 2003
@@ -207,6 +207,14 @@
c.attr = PublicMethod()
self.assertPolicyAllows(c, 'attr')
+ def testUnicodeAttributeLookups(self):
+ item = self.item
+ r_item = self.a.r_item
+ self.assertPolicyAllows(item, u'public_prop')
+ self.assertPolicyDenies(r_item, u'private_prop')
+ self.assertPolicyAllows(item, u'public_m')
+ self.assertPolicyDenies(item, u'dangerous_m')
+
def testRolesForPermission(self):
# Test of policy.checkPermission().
r_item = self.a.r_item
@@ -217,6 +225,15 @@
v = self.policy.checkPermission('View', r_item, o_context)
self.assert_(v, '_View_Permission should grant access to theowner')
+ def testUnicodeRolesForPermission(self):
+ r_item = self.a.r_item
+ context = self.context
+ v = self.policy.checkPermission(u'View', r_item, context)
+ self.assert_(not v, '_View_Permission should deny access to user')
+ o_context = SecurityContext(self.uf.getUserById('theowner'))
+ v = self.policy.checkPermission(u'View', r_item, o_context)
+ self.assert_(v, '_View_Permission should grant access to theowner')
+
def testAqNames(self):
policy = self.policy
names = {
@@ -252,7 +269,7 @@
def test_suite():
suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(ZopeSecurityPolicyTests))
+ suite.addTest(unittest.makeSuite(ZopeSecurityPolicyTests, 'test'))
return suite
def main():
More information about the Zope-Checkins
mailing list