Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
c1374587
Commit
c1374587
authored
Oct 18, 2001
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-fixed some tests
-removed redundant test for attributes -minor tweakings
parent
33af8d7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
35 deletions
+24
-35
lib/python/AccessControl/securitySuite/SecurityBase.py
lib/python/AccessControl/securitySuite/SecurityBase.py
+11
-6
lib/python/AccessControl/securitySuite/regressionSecurity.py
lib/python/AccessControl/securitySuite/regressionSecurity.py
+13
-29
No files found.
lib/python/AccessControl/securitySuite/SecurityBase.py
View file @
c1374587
...
...
@@ -90,7 +90,7 @@ import ZPublisher, ResultObject
class
SecurityBase
(
unittest
.
TestCase
)
:
""" Base class for all security tests
$Id: SecurityBase.py,v 1.
3 2001/10/09 14:40:53
andreasjung Exp $
$Id: SecurityBase.py,v 1.
4 2001/10/18 14:30:51
andreasjung Exp $
"""
status_regex
=
re
.
compile
(
"Status: ([0-9]{1,4}) (.*)"
,
re
.
I
)
\
...
...
@@ -164,11 +164,16 @@ class SecurityBase(unittest.TestCase) :
roles
=
eval
(
s
)
if
roles
==
None
or
len
(
roles
)
==
0
:
roles
=
(
None
,)
for
r
in
roles
:
if
not
r
in
expected_roles
:
raise
AssertionError
,
self
.
_roles_debug
(
hier
,
roles
,
expected_roles
)
roles
=
()
roles
=
list
(
roles
)
roles
.
sort
()
expected_roles
=
list
(
expected_roles
)
expected_roles
.
sort
()
if
roles
!=
expected_roles
:
raise
AssertionError
,
self
.
_roles_debug
(
hier
,
roles
,
expected_roles
)
def
_checkRequest
(
self
,
*
args
,
**
kw
):
""" perform a ZPublisher request """
...
...
lib/python/AccessControl/securitySuite/regressionSecurity.py
View file @
c1374587
...
...
@@ -85,10 +85,9 @@
#
##############################################################################
# $Id: regressionSecurity.py,v 1.
1 2001/10/11 13:33:48
andreasjung Exp $
# $Id: regressionSecurity.py,v 1.
2 2001/10/18 14:30:51
andreasjung Exp $
import
os
,
sys
execfile
(
os
.
path
.
join
(
sys
.
path
[
0
],
'framework.py'
))
import
os
,
sys
,
unittest
import
Zope
from
OFS.Folder
import
Folder
...
...
@@ -259,29 +258,6 @@ class AVeryBasicSecurityTest(SecurityBase.SecurityBase):
get_transaction
().
commit
()
def
testAttributeAccess
(
self
):
""" check access to attributes """
obj
=
self
.
root
.
test
.
f2
.
f3
.
obj3
try
:
x
=
obj
.
public_attr
obj
.
public_attr
=
'blabla'
except
:
raise
AssertionError
,
'this should work !'
try
:
x
=
obj
.
_protected_attr
raise
AssertionError
,
'this should not work !'
except
AssertionError
:
raise
try
:
obj
.
_protected_attr
=
"blalbla"
raise
AssertionError
,
'this should not work !'
except
AssertionError
:
raise
def
testNobody
(
self
):
""" check permissions for nobody user """
...
...
@@ -296,10 +272,10 @@ class AVeryBasicSecurityTest(SecurityBase.SecurityBase):
def
testPermissionAccess
(
self
):
""" check permission based access """
self
.
_checkRoles
(
'test.f2.f3.obj3.public_func'
,
(
None
,
))
self
.
_checkRoles
(
'test.f2.f3.obj3.public_func'
,
())
self
.
_checkRoles
(
'test.f2.f3.obj3.protected_func'
,
(
'Manager'
,
'Owner'
))
self
.
_checkRoles
(
'test.f2.f3.obj3.manage_func'
,
(
'Manager'
,))
self
.
_checkRoles
(
'test.f2.f3.obj3.private_func'
,
(
'Manager'
,
))
self
.
_checkRoles
(
'test.f2.f3.obj3.private_func'
,
())
def
testZPublisherAccess
(
self
):
...
...
@@ -338,5 +314,13 @@ class AVeryBasicSecurityTest(SecurityBase.SecurityBase):
else
:
res
=
self
.
_checkRequest
(
path
,
expected
=
expected
)
def
test_suite
():
return
unittest
.
makeSuite
(
AVeryBasicSecurityTest
)
framework
()
def
main
():
unittest
.
TextTestRunner
().
run
(
test_suite
())
if
__name__
==
'__main__'
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment