[Zope3-checkins] CVS: Zope3/lib/python/Zope/Security/tests - testChecker.py:1.7
Steve Alexander
steve@cat-box.net
Mon, 16 Dec 2002 08:30:55 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv12586/lib/python/Zope/Security/tests
Modified Files:
testChecker.py
Log Message:
defineChecker now insists that its 'type_' argument is a type, class or
module.
=== Zope3/lib/python/Zope/Security/tests/testChecker.py 1.6 => 1.7 ===
--- Zope3/lib/python/Zope/Security/tests/testChecker.py:1.6 Tue Nov 19 18:25:18 2002
+++ Zope3/lib/python/Zope/Security/tests/testChecker.py Mon Dec 16 08:30:55 2002
@@ -25,6 +25,7 @@
from Zope.Security.SecurityManagement import setSecurityPolicy
from Zope.Security.Proxy import getChecker, getObject
from Zope.Security.Checker import defineChecker
+import types
class SecurityPolicy:
@@ -81,6 +82,19 @@
def tearDown(self):
setSecurityPolicy(self.__oldpolicy)
CleanUp.tearDown(self)
+
+ def test_typesAcceptedByDefineChecker(self):
+ class ClassicClass:
+ __metaclass__ = types.ClassType
+ class NewStyleClass:
+ __metaclass__ = type
+ import Zope.Security
+ not_a_type = object()
+ defineChecker(ClassicClass, NamesChecker())
+ defineChecker(NewStyleClass, NamesChecker())
+ defineChecker(Zope.Security, NamesChecker())
+ self.assertRaises(TypeError,
+ defineChecker, not_a_type, NamesChecker())
# check_getattr cases:
#