[Zope-Checkins] CVS: Zope3/lib/python/Zope/Security/tests - testRestrictedInterpreter.py:1.1.2.1
Jeremy Hylton
jeremy@zope.com
Wed, 17 Apr 2002 19:16:02 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv32523/tests
Added Files:
Tag: SecurityProxy-branch
testRestrictedInterpreter.py
Log Message:
A *very* minimal restricted interpreter that doesn't depend on rexec.
including another addition to Proxy to get a minimal test for
wrappedness working
=== Added File Zope3/lib/python/Zope/Security/tests/testRestrictedInterpreter.py ===
import unittest
from Zope.Security.RestrictedInterpreter import RestrictedInterpreter
class RITests(unittest.TestCase):
def setUp(self):
self.rinterp = RestrictedInterpreter(None)
def testExec(self):
self.rinterp.ri_exec("print type(1)\n")
def testImport(self):
self.rinterp.ri_exec("import Zope.Security.Proxy")
def testWrapping(self):
# 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"
)
self.rinterp.ri_exec(code)
def test_suite():
return unittest.makeSuite(RITests)