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
443514cd
Commit
443514cd
authored
Oct 09, 2004
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Clean up spurious import dependencies.
parent
3f0db85b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
12 deletions
+22
-12
lib/python/AccessControl/tests/testClassSecurityInfo.py
lib/python/AccessControl/tests/testClassSecurityInfo.py
+22
-12
No files found.
lib/python/AccessControl/tests/testClassSecurityInfo.py
View file @
443514cd
...
...
@@ -10,22 +10,34 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
""" """
""" Unit tests for ClassSecurityInfo.
"""
import
os
,
sys
,
unittest
,
ZODB
,
Globals
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
OFS.Folder
import
Folder
import
unittest
class
ClassSecurityInfoTests
(
unittest
.
TestCase
):
def
testSetPermissionDefault
(
self
):
def
_getTargetClass
(
self
):
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
return
ClassSecurityInfo
def
test_SetPermissionDefault
(
self
):
# Test setting default roles for permissions.
import
Globals
# XXX: avoiding import cycle
from
App.class_init
import
default__class_init__
from
ExtensionClass
import
Base
ClassSecurityInfo
=
self
.
_getTargetClass
()
# Setup a test class with default role -> permission decls.
class
Test
(
Folder
):
"""Test class"""
class
Test
(
Base
):
"""Test class
"""
__ac_roles__
=
(
'Role A'
,
'Role B'
,
'Role C'
)
meta_type
=
"Test"
...
...
@@ -43,7 +55,7 @@ class ClassSecurityInfoTests(unittest.TestCase):
pass
# Do class initialization.
Globals
.
InitializeClass
(
Test
)
default__class_init__
(
Test
)
# Now check the resulting class to see if the mapping was made
# correctly. Note that this uses carnal knowledge of the internal
...
...
@@ -51,6 +63,7 @@ class ClassSecurityInfoTests(unittest.TestCase):
object
=
Test
()
imPermissionRole
=
object
.
foo__roles__
self
.
failUnless
(
len
(
imPermissionRole
)
==
4
)
for
item
in
(
'Manager'
,
'Role A'
,
'Role B'
,
'Role C'
):
self
.
failUnless
(
item
in
imPermissionRole
)
...
...
@@ -60,8 +73,5 @@ def test_suite():
suite
.
addTest
(
unittest
.
makeSuite
(
ClassSecurityInfoTests
))
return
suite
def
main
():
unittest
.
TextTestRunner
().
run
(
test_suite
())
if
__name__
==
'__main__'
:
main
(
)
unittest
.
main
(
defaultTest
=
'test_suite'
)
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