[Zope-Checkins] CVS: Zope/lib/python/AccessControl/securitySuite - ResultObject.py:1.4 SecurityBase.py:1.7 framework.py:1.3 regressionSecurity.py:1.5
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 17:27:34 -0400
Update of /cvs-repository/Zope/lib/python/AccessControl/securitySuite
In directory cvs.zope.org:/tmp/cvs-serv11760
Modified Files:
ResultObject.py SecurityBase.py framework.py
regressionSecurity.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/AccessControl/securitySuite/ResultObject.py 1.3 => 1.4 ===
--- Zope/lib/python/AccessControl/securitySuite/ResultObject.py:1.3 Wed Nov 28 10:50:52 2001
+++ Zope/lib/python/AccessControl/securitySuite/ResultObject.py Wed Aug 14 17:27:32 2002
@@ -1,20 +1,20 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
class ResultObject:
- """ result object used for keeping results from the
- ZPublisher.Zope() calls
+ """ result object used for keeping results from the
+ ZPublisher.Zope() calls
$Id$
"""
@@ -31,9 +31,8 @@
s+= "\n"
return s
-
+
__repr__ = __str__
def __call__(self,expected=-1):
return self.__str__(expected)
-
=== Zope/lib/python/AccessControl/securitySuite/SecurityBase.py 1.6 => 1.7 ===
--- Zope/lib/python/AccessControl/securitySuite/SecurityBase.py:1.6 Wed Nov 28 10:50:52 2001
+++ Zope/lib/python/AccessControl/securitySuite/SecurityBase.py Wed Aug 14 17:27:32 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
@@ -38,7 +38,7 @@
class SecurityBase(unittest.TestCase) :
- """ Base class for all security tests
+ """ Base class for all security tests
$Id$
"""
@@ -66,7 +66,7 @@
if obj.meta_type in ['Folder','TestFolder']:
folderObjs.append(obj)
- else:
+ else:
print ' '*(1+len(root.getPhysicalPath())),obj.getId(),
print getattr(obj,"__roles__",(None,))
@@ -82,11 +82,11 @@
""" permission check on an objects for a given user.
-- 'user' is a user object as returned from a user folder
-
+
-- 'hier' is the path to the object in the notation 'f1.f2.f3.obj'
-
+
-- 'perm' is a permission name
-
+
-- 'expected' is either 0 or 1
"""
@@ -95,7 +95,7 @@
res = user.has_permission(perm,obj)
- if res != expected:
+ if res != expected:
raise AssertionError, \
self._perm_debug (s,perm,res,expected)
@@ -108,7 +108,7 @@
-- 'expected_roles' is a sequence of expected roles
"""
-
+
s = "self.root.%s.__roles__" % hier
roles = eval(s)
@@ -127,18 +127,18 @@
same = 1
if not same:
raise AssertionError, self._roles_debug(hier,roles,expected_roles)
-
+
def _checkRequest(self,*args,**kw):
""" perform a ZPublisher request """
-
+
expected_code = kw.get('expected',200)
del kw['expected']
res = apply(self._request,args,kw)
if expected_code != res.code:
- raise AssertionError, \
- self._request_debug(res,expected_code,args,kw)
+ raise AssertionError, \
+ self._request_debug(res,expected_code,args,kw)
################################################################
@@ -147,12 +147,12 @@
def _perm_debug(self, obj , perm, res, expected):
s+= 'Object: %s' % obj
- s+= ', Permission: %s' % perm
- s+= ', has permission: %s' % res
+ s+= ', Permission: %s' % perm
+ s+= ', has permission: %s' % res
s+= ', expected: %s' % expected
return s
-
+
def _roles_debug(self,hier,got_roles,expected_roles):
@@ -164,13 +164,13 @@
def _request_debug(self,res,expected,args,kw):
-
- s = 'Args: %s' % str(args)
+
+ s = 'Args: %s' % str(args)
s+= ', KW: %s' % str(kw)
s+= '\n%s\n' % res.__str__(with_output=0,expected=expected)
return s
-
+
def _request(self,*args,**kw):
""" perform a Zope request """
=== Zope/lib/python/AccessControl/securitySuite/framework.py 1.2 => 1.3 ===
--- Zope/lib/python/AccessControl/securitySuite/framework.py:1.2 Wed Nov 28 10:50:52 2001
+++ Zope/lib/python/AccessControl/securitySuite/framework.py Wed Aug 14 17:27:32 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
######################################################################
@@ -42,5 +42,3 @@
import Testing, unittest
execfile(os.path.join(os.path.split(Testing.__file__)[0], 'common.py'))
-
-
=== Zope/lib/python/AccessControl/securitySuite/regressionSecurity.py 1.4 => 1.5 ===
--- Zope/lib/python/AccessControl/securitySuite/regressionSecurity.py:1.4 Wed Nov 28 10:50:52 2001
+++ Zope/lib/python/AccessControl/securitySuite/regressionSecurity.py Wed Aug 14 17:27:32 2002
@@ -3,14 +3,14 @@
##############################################################################
#
# Copyright (c) 2001 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
-#
+#
##############################################################################
# $Id$
@@ -91,9 +91,9 @@
def __init__(self,id):
self.id = id
-
- def getId(self): return self.id
+
+ def getId(self): return self.id
meta_type = 'TestFolder'
@@ -154,7 +154,7 @@
for user in USERS:
try: acl._delUsers( user.username )
except: pass
-
+
for user in USERS:
acl._addUser(user.username,user.password,user.password,
user.roles, [])
@@ -162,7 +162,7 @@
# try to remove old crap
if 'test' in self.root.objectIds():
- self.root._delObject('test')
+ self.root._delObject('test')
# setup Folder hierarchy
@@ -185,12 +185,12 @@
def testNobody(self):
""" check permissions for nobody user """
- self._checkPermission(nobody,'test.f1', 'View',1)
- self._checkPermission(nobody,'test.f2', 'View',1)
- self._checkPermission(nobody,'test.f2.f3','View',1)
- self._checkPermission(nobody,'test.f1', MAGIC_PERMISSION1, None)
- self._checkPermission(nobody,'test.f2', MAGIC_PERMISSION1, None)
- self._checkPermission(nobody,'test.f2.f3',MAGIC_PERMISSION1, None)
+ self._checkPermission(nobody,'test.f1', 'View',1)
+ self._checkPermission(nobody,'test.f2', 'View',1)
+ self._checkPermission(nobody,'test.f2.f3','View',1)
+ self._checkPermission(nobody,'test.f1', MAGIC_PERMISSION1, None)
+ self._checkPermission(nobody,'test.f2', MAGIC_PERMISSION1, None)
+ self._checkPermission(nobody,'test.f2.f3',MAGIC_PERMISSION1, None)
def testPermissionAccess(self):
@@ -242,7 +242,7 @@
def test_suite():
return unittest.makeSuite(AVeryBasicSecurityTest)
-
+
def main():
unittest.TextTestRunner().run(test_suite())