Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e3eb7f6c
authored
Jan 15, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
acl: add tests for get_objects_with_level
parent
c5b84d2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
circle/acl/tests/test_acl.py
+20
-0
No files found.
circle/acl/tests/test_acl.py
View file @
e3eb7f6c
...
...
@@ -150,6 +150,26 @@ class AclUserTest(TestCase):
i
.
set_level
(
self
.
g1
,
None
)
self
.
assertFalse
(
i
.
has_level
(
self
.
u1
,
'alfa'
))
def
test_get_objects_with_level
(
self
):
i1
=
TestModel
.
objects
.
create
(
normal_field
=
'Hello1'
)
i2
=
TestModel
.
objects
.
create
(
normal_field
=
'Hello2'
)
i1
.
set_level
(
self
.
u1
,
'alfa'
)
i2
.
set_level
(
self
.
u1
,
'bravo'
)
i2
.
set_level
(
self
.
u2
,
'bravo'
)
self
.
assertItemsEqual
(
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u1
),
[
i1
,
i2
])
self
.
assertItemsEqual
(
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u2
),
[
i2
])
def
test_get_objects_with_level_for_group
(
self
):
i1
=
TestModel
.
objects
.
create
(
normal_field
=
'Hello1'
)
i2
=
TestModel
.
objects
.
create
(
normal_field
=
'Hello2'
)
i1
.
set_level
(
self
.
g1
,
'alfa'
)
i2
.
set_level
(
self
.
g1
,
'bravo'
)
i2
.
set_level
(
self
.
u1
,
'bravo'
)
self
.
assertItemsEqual
(
TestModel
.
get_objects_with_level
(
'alfa'
,
self
.
u1
),
[
i1
,
i2
])
def
test_get_objects_with_group_level
(
self
):
i1
=
TestModel
.
objects
.
create
(
normal_field
=
'Hello1'
)
i2
=
TestModel
.
objects
.
create
(
normal_field
=
'Hello2'
)
...
...
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