[Zope-Checkins] CVS: Packages/AccessControl/tests - testAcquisition.py:1.1.4.2

Stefan H. Holek stefan at epy.co.at
Sat Feb 12 12:47:57 EST 2005


Update of /cvs-repository/Packages/AccessControl/tests
In directory cvs.zope.org:/tmp/cvs-serv30635

Modified Files:
      Tag: shh-aqtests-branch
	testAcquisition.py 
Log Message:
Also test Richard Jones' use-case of acquiring a string property
i.e. a simple type not an object.


=== Packages/AccessControl/tests/testAcquisition.py 1.1.4.1 => 1.1.4.2 ===
--- Packages/AccessControl/tests/testAcquisition.py:1.1.4.1	Mon Jan 24 13:47:36 2005
+++ Packages/AccessControl/tests/testAcquisition.py	Sat Feb 12 12:47:56 2005
@@ -72,19 +72,26 @@
         get_transaction().begin()
         self.app = makerequest(Zope.app())
         try:
+
             # Set up a manager user
             self.uf = self.app.acl_users
             self.uf._doAddUser('manager', 'secret', ['Manager'], [])
             self.login('manager')
+
             # Set up objects in the root that we want to aquire
             self.app.manage_addFolder('plain_folder')
             self.app._setObject('error_log2', ProtectedSiteErrorLog())
+
+            # We also want to be able to acquire simple attributes
+            self.app.manage_addProperty(id='simple_type', type='string', value='a string')
+
             # Set up a subfolder and the objects we want to acquire from
             self.app.manage_addFolder('subfolder')
             self.folder = self.app.subfolder
             self.folder._setObject('allowed', AllowedItem())
             self.folder._setObject('denied', DeniedItem())
             self.folder._setObject('protected', ProtectedItem())
+
         except:
             self.tearDown()
             raise
@@ -186,6 +193,23 @@
 
     # IOW, acquiring an object in restricted Python now amounts to
     # "passing it to some_method".
+
+
+    # Also test Richard Jones' use-case of acquiring a string:
+
+    def testSimpleTypeAllowed(self):
+        o = 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')
+        self.assertEqual(o, 'a string')
+
+    def testSimpleTypeProtected(self):
+        # XXX: Fails in 2.7.3 for Anonymous
+        o = guarded_getattr(self.folder.protected, 'simple_type')
+        self.assertEqual(o, 'a string')
 
 
 class TestGetAttrAnonymous(TestGetAttr):



More information about the Zope-Checkins mailing list