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
d7a937b4
Commit
d7a937b4
authored
May 16, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coverage for SimpleUser.
parent
e7b71fdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
src/AccessControl/tests/testUser.py
src/AccessControl/tests/testUser.py
+30
-0
No files found.
src/AccessControl/tests/testUser.py
View file @
d7a937b4
...
@@ -67,6 +67,35 @@ class BasicUserTests(unittest.TestCase):
...
@@ -67,6 +67,35 @@ class BasicUserTests(unittest.TestCase):
self
.
assertEqual
(
repr
(
derived
),
"<Derived 'phred'>"
)
self
.
assertEqual
(
repr
(
derived
),
"<Derived 'phred'>"
)
class
SimpleUserTests
(
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
AccessControl.User
import
SimpleUser
return
SimpleUser
def
_makeOne
(
self
,
name
=
'admin'
,
password
=
'123'
,
roles
=
None
,
domains
=
None
):
if
roles
is
None
:
roles
=
[
'Manager'
]
if
domains
is
None
:
domains
=
[]
return
self
.
_getTargetClass
()(
name
,
password
,
roles
,
domains
)
def
test_overrides
(
self
):
simple
=
self
.
_makeOne
()
self
.
assertEqual
(
simple
.
getUserName
(),
'admin'
)
self
.
assertEqual
(
simple
.
getId
(),
'admin'
)
self
.
assertEqual
(
simple
.
_getPassword
(),
'123'
)
self
.
assertEqual
(
simple
.
getDomains
(),
())
def
test_getRoles_anonymous
(
self
):
simple
=
self
.
_makeOne
(
'Anonymous User'
,
roles
=
())
self
.
assertEqual
(
simple
.
getRoles
(),
())
def
test_getRoles_non_anonymous
(
self
):
simple
=
self
.
_makeOne
(
'phred'
,
roles
=
())
self
.
assertEqual
(
simple
.
getRoles
(),
(
'Authenticated'
,))
class
UserTests
(
unittest
.
TestCase
):
class
UserTests
(
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
def
_getTargetClass
(
self
):
...
@@ -385,6 +414,7 @@ class UserFolderTests(unittest.TestCase):
...
@@ -385,6 +414,7 @@ class UserFolderTests(unittest.TestCase):
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
BasicUserTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
BasicUserTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
SimpleUserTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
UserTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
UserTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
UserFolderTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
UserFolderTests
))
return
suite
return
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