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
72464340
authored
Jul 23, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix tests
parent
c2037190
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
81 deletions
+3
-81
circle/dashboard/tests/test_views.py
+0
-78
circle/network/tests/test_views.py
+3
-3
No files found.
circle/dashboard/tests/test_views.py
View file @
72464340
...
@@ -1363,84 +1363,6 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -1363,84 +1363,6 @@ class GroupDetailTest(LoginMixin, TestCase):
self
.
assertEqual
(
user_in_group
-
1
,
self
.
g1
.
user_set
.
count
())
self
.
assertEqual
(
user_in_group
-
1
,
self
.
g1
.
user_set
.
count
())
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_anon_remove_acluser_from_group
(
self
):
c
=
Client
()
gp
=
self
.
g1
.
profile
acl_users
=
len
(
gp
.
get_users_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/remove/acl/user/'
+
str
(
self
.
u4
.
pk
)
+
'/'
)
self
.
assertEqual
(
acl_users
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_unpermitted_remove_acluser_from_group
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user3'
)
gp
=
self
.
g1
.
profile
acl_users
=
len
(
gp
.
get_users_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/remove/acl/user/'
+
str
(
self
.
u4
.
pk
)
+
'/'
)
self
.
assertEqual
(
acl_users
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
403
)
def
test_superuser_remove_acluser_from_group
(
self
):
c
=
Client
()
gp
=
self
.
g1
.
profile
self
.
login
(
c
,
'superuser'
)
acl_users
=
len
(
gp
.
get_users_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/remove/acl/user/'
+
str
(
self
.
u4
.
pk
)
+
'/'
)
self
.
assertEqual
(
acl_users
-
1
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_permitted_remove_acluser_from_group
(
self
):
c
=
Client
()
gp
=
self
.
g1
.
profile
self
.
login
(
c
,
'user0'
)
acl_users
=
len
(
gp
.
get_users_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/remove/acl/user/'
+
str
(
self
.
u4
.
pk
)
+
'/'
)
self
.
assertEqual
(
acl_users
-
1
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_anon_remove_aclgroup_from_group
(
self
):
c
=
Client
()
gp
=
self
.
g1
.
profile
acl_groups
=
len
(
gp
.
get_groups_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/remove/acl/group/'
+
str
(
self
.
g3
.
pk
)
+
'/'
)
self
.
assertEqual
(
acl_groups
,
len
(
gp
.
get_groups_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_unpermitted_remove_aclgroup_from_group
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user3'
)
gp
=
self
.
g1
.
profile
acl_groups
=
len
(
gp
.
get_groups_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/remove/acl/group/'
+
str
(
self
.
g3
.
pk
)
+
'/'
)
self
.
assertEqual
(
acl_groups
,
len
(
gp
.
get_groups_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
403
)
def
test_superuser_remove_aclgroup_from_group
(
self
):
c
=
Client
()
gp
=
self
.
g1
.
profile
acl_groups
=
len
(
gp
.
get_groups_with_level
())
self
.
login
(
c
,
'superuser'
)
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/remove/acl/group/'
+
str
(
self
.
g3
.
pk
)
+
'/'
)
self
.
assertEqual
(
acl_groups
-
1
,
len
(
gp
.
get_groups_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_permitted_remove_aclgroup_from_group
(
self
):
c
=
Client
()
gp
=
self
.
g1
.
profile
acl_groups
=
len
(
gp
.
get_groups_with_level
())
self
.
login
(
c
,
'user0'
)
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/remove/acl/group/'
+
str
(
self
.
g3
.
pk
)
+
'/'
)
self
.
assertEqual
(
acl_groups
-
1
,
len
(
gp
.
get_groups_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_unpermitted_user_add_wo_group_perm
(
self
):
def
test_unpermitted_user_add_wo_group_perm
(
self
):
user_count
=
self
.
g1
.
user_set
.
count
()
user_count
=
self
.
g1
.
user_set
.
count
()
c
=
Client
()
c
=
Client
()
...
...
circle/network/tests/test_views.py
View file @
72464340
...
@@ -63,7 +63,7 @@ class VlanAclTest(LoginMixin, TestCase):
...
@@ -63,7 +63,7 @@ class VlanAclTest(LoginMixin, TestCase):
vlan
=
Vlan
.
objects
.
get
(
vid
=
1
)
vlan
=
Vlan
.
objects
.
get
(
vid
=
1
)
self
.
assertEqual
([],
vlan
.
get_users_with_level
())
self
.
assertEqual
([],
vlan
.
get_users_with_level
())
resp
=
c
.
post
(
"/network/vlans/
1
/acl/"
,
{
resp
=
c
.
post
(
"/network/vlans/
2
/acl/"
,
{
'name'
:
"user1"
,
'name'
:
"user1"
,
'level'
:
"user"
,
'level'
:
"user"
,
})
})
...
@@ -80,7 +80,7 @@ class VlanAclTest(LoginMixin, TestCase):
...
@@ -80,7 +80,7 @@ class VlanAclTest(LoginMixin, TestCase):
vlan
.
set_level
(
self
.
u1
,
"user"
)
vlan
.
set_level
(
self
.
u1
,
"user"
)
self
.
assertTrue
((
self
.
u1
,
"user"
)
in
vlan
.
get_users_with_level
())
self
.
assertTrue
((
self
.
u1
,
"user"
)
in
vlan
.
get_users_with_level
())
resp
=
c
.
post
(
"/network/vlans/
1
/acl/"
,
{
resp
=
c
.
post
(
"/network/vlans/
2
/acl/"
,
{
'perm-u-
%
d'
%
self
.
u1
.
pk
:
"operator"
,
'perm-u-
%
d'
%
self
.
u1
.
pk
:
"operator"
,
'level'
:
""
,
'level'
:
""
,
'name'
:
""
,
'name'
:
""
,
...
@@ -97,7 +97,7 @@ class VlanAclTest(LoginMixin, TestCase):
...
@@ -97,7 +97,7 @@ class VlanAclTest(LoginMixin, TestCase):
vlan
.
set_level
(
self
.
u1
,
"user"
)
vlan
.
set_level
(
self
.
u1
,
"user"
)
self
.
assertTrue
((
self
.
u1
,
"user"
)
in
vlan
.
get_users_with_level
())
self
.
assertTrue
((
self
.
u1
,
"user"
)
in
vlan
.
get_users_with_level
())
resp
=
c
.
post
(
"/network/vlans/
1
/acl/"
,
{
resp
=
c
.
post
(
"/network/vlans/
2
/acl/"
,
{
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'level'
:
""
,
'level'
:
""
,
'name'
:
""
,
'name'
:
""
,
...
...
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