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
fbb9f2aa
authored
May 27, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add tests
parent
a7ae6242
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
circle/dashboard/tests/test_views.py
+35
-0
No files found.
circle/dashboard/tests/test_views.py
View file @
fbb9f2aa
...
@@ -1475,6 +1475,41 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -1475,6 +1475,41 @@ class GroupDetailTest(LoginMixin, TestCase):
self
.
assertEqual
(
acl_groups
-
1
,
len
(
gp
.
get_groups_with_level
()))
self
.
assertEqual
(
acl_groups
-
1
,
len
(
gp
.
get_groups_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_unpermitted_user_add_wo_group_perm
(
self
):
user_count
=
self
.
g1
.
user_set
.
count
()
c
=
Client
()
self
.
login
(
c
,
'user1'
)
response
=
c
.
post
(
'/dashboard/group/
%
d/create/'
%
self
.
g1
.
pk
,
{
'username'
:
'userx1'
,
'password1'
:
'test123'
,
'password2'
:
'test123'
})
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
user_count
,
self
.
g1
.
user_set
.
count
())
def
test_permitted_user_add_wo_can_add_user_perm
(
self
):
user_count
=
self
.
g1
.
user_set
.
count
()
c
=
Client
()
self
.
login
(
c
,
'user0'
)
response
=
c
.
post
(
'/dashboard/group/
%
d/create/'
%
self
.
g1
.
pk
,
{
'username'
:
'userx2'
,
'password1'
:
'test123'
,
'password2'
:
'test123'
})
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
user_count
,
self
.
g1
.
user_set
.
count
())
def
test_permitted_user_add
(
self
):
user_count
=
self
.
g1
.
user_set
.
count
()
self
.
u0
.
user_permissions
.
add
(
Permission
.
objects
.
get
(
name
=
'Can add user'
))
c
=
Client
()
self
.
login
(
c
,
'user0'
)
response
=
c
.
post
(
'/dashboard/group/
%
d/create/'
%
self
.
g1
.
pk
,
{
'username'
:
'userx2'
,
'password1'
:
'test123'
,
'password2'
:
'test123'
})
self
.
assertEqual
(
user_count
+
1
,
self
.
g1
.
user_set
.
count
())
self
.
assertEqual
(
response
.
status_code
,
302
)
class
GroupListTest
(
LoginMixin
,
TestCase
):
class
GroupListTest
(
LoginMixin
,
TestCase
):
fixtures
=
[
'test-vm-fixture.json'
,
'node.json'
]
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