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
30a5419d
Commit
30a5419d
authored
May 21, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for 'Products.SiteAccess.AccessRule.getAccessRule'.
parent
b3dcf745
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
src/Products/SiteAccess/tests/testAccessRule.py
src/Products/SiteAccess/tests/testAccessRule.py
+25
-0
No files found.
src/Products/SiteAccess/tests/testAccessRule.py
View file @
30a5419d
...
@@ -172,6 +172,30 @@ class Test_manage_addAccessRule(unittest.TestCase):
...
@@ -172,6 +172,30 @@ class Test_manage_addAccessRule(unittest.TestCase):
self
.
assertEqual
(
new_rule
.
icon
,
'misc_/SiteAccess/AccessRule.gif'
)
self
.
assertEqual
(
new_rule
.
icon
,
'misc_/SiteAccess/AccessRule.gif'
)
class
Test_getAccessRule
(
unittest
.
TestCase
):
def
_callFUT
(
self
,
container
,
REQUEST
=
None
):
from
Products.SiteAccess.AccessRule
import
getAccessRule
return
getAccessRule
(
container
,
REQUEST
)
def
test_no_rules
(
self
):
container
=
DummyContainer
()
self
.
assertEqual
(
self
.
_callFUT
(
container
),
''
)
def
test_w_rule_invalid
(
self
):
from
ZPublisher.BeforeTraverse
import
registerBeforeTraverse
container
=
DummyContainer
()
registerBeforeTraverse
(
container
,
DummyObject
(),
'AccessRule'
)
self
.
failUnless
(
self
.
_callFUT
(
container
).
startswith
(
'Invalid BeforeTraverse data: '
))
def
test_w_rule_valid
(
self
):
from
ZPublisher.BeforeTraverse
import
registerBeforeTraverse
container
=
DummyContainer
()
registerBeforeTraverse
(
container
,
DummyObject
(
name
=
'foo'
),
'AccessRule'
)
self
.
assertEqual
(
self
.
_callFUT
(
container
),
'foo'
)
class
DummyRequest
(
dict
):
class
DummyRequest
(
dict
):
_virtual_root
=
None
_virtual_root
=
None
def
setVirtualRoot
(
self
,
root
):
def
setVirtualRoot
(
self
,
root
):
...
@@ -196,5 +220,6 @@ def test_suite():
...
@@ -196,5 +220,6 @@ def test_suite():
return
unittest
.
TestSuite
((
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
AccessRuleTests
),
unittest
.
makeSuite
(
AccessRuleTests
),
unittest
.
makeSuite
(
Test_manage_addAccessRule
),
unittest
.
makeSuite
(
Test_manage_addAccessRule
),
unittest
.
makeSuite
(
Test_getAccessRule
),
))
))
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