[Zope-Checkins] CVS: Zope3/lib/python/Zope/Security/tests - testRestrictedInterpreter.py:1.1.2.2

Guido van Rossum guido@python.org
Thu, 18 Apr 2002 11:52:15 -0400


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

Modified Files:
      Tag: SecurityProxy-branch
	testRestrictedInterpreter.py 
Log Message:
Use a real Checker.

Fix the test "id.__class__ != ..." to use "type(id) is not ..." instead.


=== Zope3/lib/python/Zope/Security/tests/testRestrictedInterpreter.py 1.1.2.1 => 1.1.2.2 ===
 
 from Zope.Security.RestrictedInterpreter import RestrictedInterpreter
+from Zope.Security.Proxy import Proxy
 
+class Checker:
+    def check_getattr(self, object, name):
+        pass
+    def proxy(self, value, checked):
+        return Proxy(value, self)
 
 class RITests(unittest.TestCase):
 
     def setUp(self):
-        self.rinterp = RestrictedInterpreter(None)
+        self.checker = Checker()
+        self.rinterp = RestrictedInterpreter(self.checker)
 
     def testExec(self):
         self.rinterp.ri_exec("print type(1)\n")
@@ -18,7 +25,7 @@
         # make sure we've really got proxies
         code = ("from Zope.Security.Proxy import Proxy, _Proxy\n"
                 "import types\n"
-                "assert id.__class__ != types.BuiltinFunctionType\n"
+                "assert type(id) is not types.BuiltinFunctionType\n"
                 )
         self.rinterp.ri_exec(code)