[Zope-Checkins] CVS: Zope3/lib/python/Zope/Security/tests - testRestrictedInterpreter.py:1.1.2.5 test_Proxy.py:1.1.2.10
Guido van Rossum
guido@python.org
Thu, 18 Apr 2002 16:03:13 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv32227/tests
Modified Files:
Tag: SecurityProxy-branch
testRestrictedInterpreter.py test_Proxy.py
Log Message:
Refactor the check_foo(ob) calls into check(ob, "__foo__").
=== Zope3/lib/python/Zope/Security/tests/testRestrictedInterpreter.py 1.1.2.4 => 1.1.2.5 ===
def check_getattr(self, object, name):
pass
+ def check(self, object, opname):
+ pass
def proxy(self, value):
return Proxy(value, self)
- def __getattr__(self, name):
- if name.startswith("check_"):
- return lambda *args: None
- else:
- raise AttributeError, name
class RITests(unittest.TestCase):
=== Zope3/lib/python/Zope/Security/tests/test_Proxy.py 1.1.2.9 => 1.1.2.10 ===
if name != "foo":
raise RuntimeError
- return "hello"
def check_setattr(self, object, name):
if name != "foo":
raise RuntimeError
- def check_getitem(self, object):
+ def check(self, object, opname):
if not self.ok:
raise RuntimeError
- return "hello"
-
- def check_setitem(self, object):
- if not self.ok:
- raise RuntimeError
- return "hello"
-
- def check_call(self, object):
- if not self.ok:
- raise RuntimeError
- return "hello"
-
- def check_str(self, object):
- return "hello"
-
- def check_repr(self, object):
- return "hello"
-
- def check_richcompare(self, object):
- if not self.ok:
- raise RuntimeError
- return "hello"
def proxy(self, value):
if isinstance(value, str):