Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
19c9ac38
authored
May 05, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add basic tests to GroupList
parent
90160c26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
circle/dashboard/tests/test_views.py
+43
-0
No files found.
circle/dashboard/tests/test_views.py
View file @
19c9ac38
...
...
@@ -766,6 +766,49 @@ class NodeDetailTest(LoginMixin, TestCase):
self
.
assertEqual
(
node_enabled
,
not
Node
.
objects
.
get
(
pk
=
1
)
.
enabled
)
class
GroupListTest
(
LoginMixin
,
TestCase
):
fixtures
=
[
'test-vm-fixture.json'
,
'node.json'
]
def
setUp
(
self
):
self
.
u1
=
User
.
objects
.
create
(
username
=
'user1'
)
self
.
u1
.
set_password
(
'password'
)
self
.
u1
.
save
()
permlist
=
Permission
.
objects
.
all
()
self
.
u1
.
user_permissions
.
add
(
filter
(
lambda
element
:
'group'
in
element
.
name
and
'add'
in
element
.
name
,
permlist
)[
0
])
self
.
u2
=
User
.
objects
.
create
(
username
=
'user2'
)
self
.
u2
.
set_password
(
'password'
)
self
.
u2
.
save
()
self
.
g1
=
Group
.
objects
.
create
(
name
=
'group1'
)
self
.
g1
.
profile
.
set_user_level
(
self
.
u1
,
'owner'
)
self
.
g1
.
save
()
self
.
g2
=
Group
.
objects
.
create
(
name
=
'group2'
)
self
.
g2
.
profile
.
set_user_level
(
self
.
u1
,
'owner'
)
self
.
g2
.
save
()
self
.
g3
=
Group
.
objects
.
create
(
name
=
'group3'
)
self
.
g3
.
profile
.
set_user_level
(
self
.
u1
,
'owner'
)
self
.
g3
.
save
()
def
test_anon_filter
(
self
):
c
=
Client
()
response
=
c
.
get
(
'/dashboard/group/list/?s="3"'
)
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_permitteduser_filter
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user1'
)
response
=
c
.
get
(
'/dashboard/group/list/?s="3"'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
tearDown
(
self
):
super
(
GroupListTest
,
self
)
.
tearDown
()
self
.
u1
.
delete
()
self
.
u2
.
delete
()
self
.
g1
.
delete
()
self
.
g2
.
delete
()
class
VmDetailVncTest
(
LoginMixin
,
TestCase
):
fixtures
=
[
'test-vm-fixture.json'
,
'node.json'
]
...
...
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