[Zope3-checkins] CVS: Zope3/lib/python/Zope/Security/tests - testChecker.py:1.6

Jim Fulton jim@zope.com
Tue, 19 Nov 2002 18:25:49 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv11465/lib/python/Zope/Security/tests

Modified Files:
	testChecker.py 
Log Message:

Two changes that were far reaching and interdependent.

- Changed existing directives that mention interfaces to register
  those interfaces with the global interface service.

- Moved all configuration support (except that in Zope.Configuration)
  into Zope.App. This was necessary to get the order of execution such
  that the interface service was defined before directives that used
  interfaces were used.  This is a change that has been needed for
  some time.



=== Zope3/lib/python/Zope/Security/tests/testChecker.py 1.5 => 1.6 ===
--- Zope3/lib/python/Zope/Security/tests/testChecker.py:1.5	Tue Oct  1 08:47:50 2002
+++ Zope3/lib/python/Zope/Security/tests/testChecker.py	Tue Nov 19 18:25:18 2002
@@ -43,6 +43,14 @@
     ############################################################
 
 
+class TransparentProxy(object):
+    def __init__(self, ob):
+        self._ob = ob
+
+    def __getattribute__(self, name):
+        ob = object.__getattribute__(self, '_ob')
+        return getattr(ob, name)
+
 class OldInst:
     a=1
     
@@ -187,15 +195,16 @@
             special = NamesChecker(['a', 'b'], 'test_allowed')
             defineChecker(class_, special)
 
-            proxy = checker.proxy(inst)
-            self.failUnless(getObject(proxy) is inst)
+            for ob in inst, TransparentProxy(inst):
+                proxy = checker.proxy(ob)
+                self.failUnless(getObject(proxy) is ob)
 
-                
-            checker = getChecker(proxy)
-            self.failUnless(checker is special, checker.__dict__)
+                checker = getChecker(proxy)
+                self.failUnless(checker is special,
+                                checker.getPermission_func().__self__)
 
-            proxy2 = checker.proxy(proxy)
-            self.failUnless(proxy2 is proxy, [proxy, proxy2])
+                proxy2 = checker.proxy(proxy)
+                self.failUnless(proxy2 is proxy, [proxy, proxy2])
 
     def testMultiChecker(self):
         from Interface import Interface