[Zope3-checkins] CVS: Zope3/src/zope/security/tests - test_checker.py:1.1.2.4 test_proxy.py:1.1.2.2 test_restrictedbuiltins.py:1.1.2.3 test_securitymanagement.py:1.1.2.3 test_securitymanager.py:1.1.2.3
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:50 -0500
Update of /cvs-repository/Zope3/src/zope/security/tests
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/security/tests
Modified Files:
Tag: NameGeddon-branch
test_checker.py test_proxy.py test_restrictedbuiltins.py
test_securitymanagement.py test_securitymanager.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/security/tests/test_checker.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/security/tests/test_checker.py:1.1.2.3 Tue Dec 24 07:51:30 2002
+++ Zope3/src/zope/security/tests/test_checker.py Tue Dec 24 21:21:18 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -47,10 +47,10 @@
class OldInst:
a=1
-
+
def b(self):
pass
-
+
c=2
def gete(self): return 3
@@ -94,7 +94,7 @@
# - no attribute there
# - method
# - allow and disallow by permission
- def test_check_getattr(self):
+ def test_check_getattr(self):
oldinst = OldInst()
oldinst.d = OldInst()
@@ -139,7 +139,7 @@
self.assertRaises(Forbidden, checker.check_getattr, inst, 'e')
self.assertRaises(Forbidden, checker.check_getattr, inst, 'f')
- def test_check_setattr(self):
+ def test_check_setattr(self):
oldinst = OldInst()
oldinst.d = OldInst()
@@ -182,7 +182,7 @@
AttributeError, AttributeError(),
):
proxy = checker.proxy(rock)
-
+
self.failUnless(proxy is rock, (rock, type(proxy)))
for class_ in OldInst, NewInst:
@@ -198,7 +198,7 @@
else:
self.assertEqual(checker.permission_id('__str__'),
CheckerPublic)
-
+
special = NamesChecker(['a', 'b'], 'test_allowed')
defineChecker(class_, special)
@@ -258,13 +258,13 @@
self.assertEqual(checker.permission_id('y'), 'p4')
self.assertEqual(checker.permission_id('z'), 'p4')
self.assertEqual(checker.permission_id('zzz'), None)
-
+
def testNonPrivateChecker(self):
from zope.security.checker import NonPrivateChecker
checker = NonPrivateChecker('p')
self.assertEqual(checker.permission_id('z'), 'p')
self.assertEqual(checker.permission_id('_z'), None)
-
+
def testAlwaysAvailable(self):
from zope.security.checker import NamesChecker
checker = NamesChecker(())
@@ -295,11 +295,3 @@
if __name__=='__main__':
main(defaultTest='test_suite')
-
-
-
-
-
-
-
-
=== Zope3/src/zope/security/tests/test_proxy.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/security/tests/test_proxy.py:1.1.2.1 Mon Dec 23 14:33:17 2002
+++ Zope3/src/zope/security/tests/test_proxy.py Tue Dec 24 21:21:18 2002
@@ -84,7 +84,7 @@
"<security proxied %s.%s instance at"
% (x.__class__.__module__, x.__class__.__name__)),
s)
-
+
def testRepr(self):
self.assertEqual(repr(self.p), repr(self.x))
@@ -132,7 +132,7 @@
self.assertEqual(self.p[0], 42)
del self.p[0]
self.shouldFail(lambda: self.p[0])
-
+
def testDelItemFail(self):
def doit(): self.p[10] = 42
self.shouldFail(doit)
=== Zope3/src/zope/security/tests/test_restrictedbuiltins.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/security/tests/test_restrictedbuiltins.py:1.1.2.2 Mon Dec 23 17:03:20 2002
+++ Zope3/src/zope/security/tests/test_restrictedbuiltins.py Tue Dec 24 21:21:18 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""
@@ -36,8 +36,8 @@
'__import__("zope.security", {}, None, ["__doc__"]).__name__'),
"zope.security")
self.assertRaises(Forbidden, e, '__import__("sys").exit')
-
-
+
+
def test_suite():
return makeSuite(Test)
=== Zope3/src/zope/security/tests/test_securitymanagement.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/security/tests/test_securitymanagement.py:1.1.2.2 Mon Dec 23 16:59:30 2002
+++ Zope3/src/zope/security/tests/test_securitymanagement.py Tue Dec 24 21:21:18 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
""" Unit tests for SecurityManagement
@@ -111,7 +111,7 @@
newSecurityManager('some user')
mgr = getSecurityManager()
self.failIf( mgr.checkPermission( None, None ) )
-
+
def test_suite():
loader=unittest.TestLoader()
=== Zope3/src/zope/security/tests/test_securitymanager.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/security/tests/test_securitymanager.py:1.1.2.2 Mon Dec 23 17:03:20 2002
+++ Zope3/src/zope/security/tests/test_securitymanager.py Tue Dec 24 21:21:18 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
""" Unit tests for SecurityManager """
@@ -48,7 +48,7 @@
setSecurityPolicy( self._oldPolicy )
def _makeMgr( self ):
-
+
from zope.security.securitymanager import SecurityManager
return SecurityManager( self._context )
@@ -57,7 +57,7 @@
from zope.security.securitymanager import setSecurityPolicy
setSecurityPolicy( PermissiveSecurityPolicy() )
-
+
def test_import( self ):
from zope.security.securitymanager import SecurityManager
@@ -66,27 +66,27 @@
verifyClass( ISecurityManager, SecurityManager )
def test_empty( self ):
-
+
mgr = self._makeMgr()
self.assertEqual( mgr.getPrincipal(), self._context.user )
self.failIf( mgr.calledByExecutable() )
def test_w_default_policy( self ):
-
+
mgr = self._makeMgr()
self.failIf( mgr.checkPermission( None, None ) )
def test_w_permissive_policy( self ):
-
+
mgr = self._makeMgr()
self._setPermissive()
self.failUnless( mgr.checkPermission( None, None ) )
def test_exec_stack_overflow( self ):
-
+
from zope.security.securitymanager import MAX_STACK_SIZE
mgr = self._makeMgr()