[Zope-Checkins] CVS: Packages/AccessControl/tests -
testAcquisition.py:1.1.4.3
Jim Fulton
jim at zope.com
Mon Feb 14 14:23:07 EST 2005
Update of /cvs-repository/Packages/AccessControl/tests
In directory cvs.zope.org:/tmp/cvs-serv20611/lib/python/AccessControl/tests
Modified Files:
Tag: shh-aqtests-branch
testAcquisition.py
Log Message:
Duped the ImplPython tests for ImplC.
=== Packages/AccessControl/tests/testAcquisition.py 1.1.4.2 => 1.1.4.3 ===
--- Packages/AccessControl/tests/testAcquisition.py:1.1.4.2 Sat Feb 12 12:47:56 2005
+++ Packages/AccessControl/tests/testAcquisition.py Mon Feb 14 14:23:06 2005
@@ -30,7 +30,8 @@
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.Permissions import view, view_management_screens
-from AccessControl.ImplPython import guarded_getattr
+from AccessControl.ImplPython import guarded_getattr as guarded_getattr_py
+from AccessControl.ImplC import guarded_getattr as guarded_getattr_c
from Products.SiteErrorLog.SiteErrorLog import SiteErrorLog
@@ -69,6 +70,7 @@
class TestGetAttr(unittest.TestCase):
def setUp(self):
+ self.guarded_getattr = guarded_getattr_py
get_transaction().begin()
self.app = makerequest(Zope.app())
try:
@@ -109,75 +111,75 @@
# Acquire plain folder
def testFolderAllowed(self):
- o = guarded_getattr(self.folder.allowed, 'plain_folder')
+ o = self.guarded_getattr(self.folder.allowed, 'plain_folder')
self.assertEqual(o, self.app.plain_folder)
def testFolderDenied(self):
- o = guarded_getattr(self.folder.denied, 'plain_folder')
+ o = self.guarded_getattr(self.folder.denied, 'plain_folder')
self.assertEqual(o, self.app.plain_folder)
def testFolderProtected(self):
- o = guarded_getattr(self.folder.protected, 'plain_folder')
+ o = self.guarded_getattr(self.folder.protected, 'plain_folder')
self.assertEqual(o, self.app.plain_folder)
# Acquire user folder
def testAclUsersAllowed(self):
- o = guarded_getattr(self.folder.allowed, 'acl_users')
+ o = self.guarded_getattr(self.folder.allowed, 'acl_users')
self.assertEqual(o, self.app.acl_users)
def testAclUsersDenied(self):
# XXX: Fails in 2.7.3
- o = guarded_getattr(self.folder.denied, 'acl_users')
+ o = self.guarded_getattr(self.folder.denied, 'acl_users')
self.assertEqual(o, self.app.acl_users)
def testAclUsersProtected(self):
# XXX: Fails in 2.7.3 for Anonymous
- o = guarded_getattr(self.folder.protected, 'acl_users')
+ o = self.guarded_getattr(self.folder.protected, 'acl_users')
self.assertEqual(o, self.app.acl_users)
# Acquire browser id manager
def testBrowserIdManagerAllowed(self):
- o = guarded_getattr(self.folder.allowed, 'browser_id_manager')
+ o = self.guarded_getattr(self.folder.allowed, 'browser_id_manager')
self.assertEqual(o, self.app.browser_id_manager)
def testBrowserIdManagerDenied(self):
- o = guarded_getattr(self.folder.denied, 'browser_id_manager')
+ o = self.guarded_getattr(self.folder.denied, 'browser_id_manager')
self.assertEqual(o, self.app.browser_id_manager)
def testBrowserIdManagerProtected(self):
- o = guarded_getattr(self.folder.protected, 'browser_id_manager')
+ o = self.guarded_getattr(self.folder.protected, 'browser_id_manager')
self.assertEqual(o, self.app.browser_id_manager)
# Acquire error log
def testErrorLogAllowed(self):
- o = guarded_getattr(self.folder.allowed, 'error_log')
+ o = self.guarded_getattr(self.folder.allowed, 'error_log')
self.assertEqual(o, self.app.error_log)
def testErrorLogDenied(self):
# XXX: Fails in 2.7.3
- o = guarded_getattr(self.folder.denied, 'error_log')
+ o = self.guarded_getattr(self.folder.denied, 'error_log')
self.assertEqual(o, self.app.error_log)
def testErrorLogProtected(self):
# XXX: Fails in 2.7.3 for Anonymous
- o = guarded_getattr(self.folder.protected, 'error_log')
+ o = self.guarded_getattr(self.folder.protected, 'error_log')
self.assertEqual(o, self.app.error_log)
# Now watch this: error log with object security declaration works fine!
def testProtectedErrorLogAllowed(self):
- o = guarded_getattr(self.folder.allowed, 'error_log2')
+ o = self.guarded_getattr(self.folder.allowed, 'error_log2')
self.assertEqual(o, self.app.error_log2)
def testProtectedErrorLogDenied(self):
- o = guarded_getattr(self.folder.denied, 'error_log2')
+ o = self.guarded_getattr(self.folder.denied, 'error_log2')
self.assertEqual(o, self.app.error_log2)
def testProtectedErrorLogProtected(self):
- o = guarded_getattr(self.folder.protected, 'error_log2')
+ o = self.guarded_getattr(self.folder.protected, 'error_log2')
self.assertEqual(o, self.app.error_log2)
# This appears to mean that any potential acquiree must make sure
@@ -198,17 +200,17 @@
# Also test Richard Jones' use-case of acquiring a string:
def testSimpleTypeAllowed(self):
- o = guarded_getattr(self.folder.allowed, 'simple_type')
+ o = self.guarded_getattr(self.folder.allowed, 'simple_type')
self.assertEqual(o, 'a string')
def testSimpleTypeDenied(self):
# XXX: Fails in 2.7.3
- o = guarded_getattr(self.folder.denied, 'simple_type')
+ o = self.guarded_getattr(self.folder.denied, 'simple_type')
self.assertEqual(o, 'a string')
def testSimpleTypeProtected(self):
# XXX: Fails in 2.7.3 for Anonymous
- o = guarded_getattr(self.folder.protected, 'simple_type')
+ o = self.guarded_getattr(self.folder.protected, 'simple_type')
self.assertEqual(o, 'a string')
@@ -222,10 +224,25 @@
noSecurityManager()
+class TestGetAttr_c(TestGetAttr):
+
+ def setUp(self):
+ TestGetAttr.setUp(self)
+ self.guarded_getattr = guarded_getattr_c
+
+class TestGetAttrAnonymous_c(TestGetAttrAnonymous):
+
+ def setUp(self):
+ TestGetAttrAnonymous.setUp(self)
+ self.guarded_getattr = guarded_getattr_c
+
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestGetAttr))
suite.addTest(unittest.makeSuite(TestGetAttrAnonymous))
+ suite.addTest(unittest.makeSuite(TestGetAttr_c))
+ suite.addTest(unittest.makeSuite(TestGetAttrAnonymous_c))
return suite
if __name__ == '__main__':
More information about the Zope-Checkins
mailing list