Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6d5826d5
authored
Jul 22, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix tests
parent
216eb60b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
26 deletions
+26
-26
circle/dashboard/tests/test_views.py
+20
-20
circle/network/tests/test_views.py
+6
-6
No files found.
circle/dashboard/tests/test_views.py
View file @
6d5826d5
...
@@ -1245,7 +1245,7 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -1245,7 +1245,7 @@ class GroupDetailTest(LoginMixin, TestCase):
acl_users
=
len
(
gp
.
get_users_with_level
())
acl_users
=
len
(
gp
.
get_users_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
{
'
perm-new-name'
:
'user3'
,
'perm-new
'
:
'owner'
})
{
'
name'
:
'user3'
,
'level
'
:
'owner'
})
self
.
assertEqual
(
acl_users
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
acl_users
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
...
@@ -1256,7 +1256,7 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -1256,7 +1256,7 @@ class GroupDetailTest(LoginMixin, TestCase):
acl_users
=
len
(
gp
.
get_users_with_level
())
acl_users
=
len
(
gp
.
get_users_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
{
'
perm-new-name'
:
'user3'
,
'perm-new
'
:
'owner'
})
{
'
name'
:
'user3'
,
'level
'
:
'owner'
})
self
.
assertEqual
(
acl_users
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
acl_users
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
...
@@ -1267,7 +1267,7 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -1267,7 +1267,7 @@ class GroupDetailTest(LoginMixin, TestCase):
acl_users
=
len
(
gp
.
get_users_with_level
())
acl_users
=
len
(
gp
.
get_users_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
{
'
perm-new-name'
:
'user3'
,
'perm-new
'
:
'owner'
})
{
'
name'
:
'user3'
,
'level
'
:
'owner'
})
self
.
assertEqual
(
acl_users
+
1
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
acl_users
+
1
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
...
@@ -1278,7 +1278,7 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -1278,7 +1278,7 @@ class GroupDetailTest(LoginMixin, TestCase):
acl_users
=
len
(
gp
.
get_users_with_level
())
acl_users
=
len
(
gp
.
get_users_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
{
'
perm-new-name'
:
'user3'
,
'perm-new
'
:
'owner'
})
{
'
name'
:
'user3'
,
'level
'
:
'owner'
})
self
.
assertEqual
(
acl_users
+
1
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
acl_users
+
1
,
len
(
gp
.
get_users_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
...
@@ -1288,7 +1288,7 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -1288,7 +1288,7 @@ class GroupDetailTest(LoginMixin, TestCase):
acl_groups
=
len
(
gp
.
get_groups_with_level
())
acl_groups
=
len
(
gp
.
get_groups_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
{
'
perm-new-name'
:
'group2'
,
'perm-new
'
:
'owner'
})
{
'
name'
:
'group2'
,
'level
'
:
'owner'
})
self
.
assertEqual
(
acl_groups
,
len
(
gp
.
get_groups_with_level
()))
self
.
assertEqual
(
acl_groups
,
len
(
gp
.
get_groups_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
...
@@ -1299,7 +1299,7 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -1299,7 +1299,7 @@ class GroupDetailTest(LoginMixin, TestCase):
acl_groups
=
len
(
gp
.
get_groups_with_level
())
acl_groups
=
len
(
gp
.
get_groups_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
{
'
perm-new-name'
:
'group2'
,
'perm-new
'
:
'owner'
})
{
'
name'
:
'group2'
,
'level
'
:
'owner'
})
self
.
assertEqual
(
acl_groups
,
len
(
gp
.
get_groups_with_level
()))
self
.
assertEqual
(
acl_groups
,
len
(
gp
.
get_groups_with_level
()))
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
...
@@ -1310,7 +1310,7 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -1310,7 +1310,7 @@ class GroupDetailTest(LoginMixin, TestCase):
acl_groups
=
len
(
gp
.
get_groups_with_level
())
acl_groups
=
len
(
gp
.
get_groups_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
{
'
perm-new-name'
:
'group2'
,
'perm-new
'
:
'owner'
})
{
'
name'
:
'group2'
,
'level
'
:
'owner'
})
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
)
...
@@ -1321,7 +1321,7 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -1321,7 +1321,7 @@ class GroupDetailTest(LoginMixin, TestCase):
acl_groups
=
len
(
gp
.
get_groups_with_level
())
acl_groups
=
len
(
gp
.
get_groups_with_level
())
response
=
c
.
post
(
'/dashboard/group/'
+
response
=
c
.
post
(
'/dashboard/group/'
+
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
str
(
self
.
g1
.
pk
)
+
'/acl/'
,
{
'
perm-new-name'
:
'group2'
,
'perm-new
'
:
'owner'
})
{
'
name'
:
'group2'
,
'level
'
:
'owner'
})
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
)
...
@@ -1769,8 +1769,8 @@ class AclViewTest(LoginMixin, TestCase):
...
@@ -1769,8 +1769,8 @@ class AclViewTest(LoginMixin, TestCase):
resp
=
c
.
post
(
"/dashboard/vm/1/acl/"
,
{
resp
=
c
.
post
(
"/dashboard/vm/1/acl/"
,
{
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'
perm-new-
name'
:
""
,
'name'
:
""
,
'
perm-new
'
:
""
,
'
level
'
:
""
,
})
})
self
.
assertFalse
((
self
.
u1
,
"user"
)
in
inst
.
get_users_with_level
())
self
.
assertFalse
((
self
.
u1
,
"user"
)
in
inst
.
get_users_with_level
())
self
.
assertEqual
(
resp
.
status_code
,
302
)
self
.
assertEqual
(
resp
.
status_code
,
302
)
...
@@ -1783,8 +1783,8 @@ class AclViewTest(LoginMixin, TestCase):
...
@@ -1783,8 +1783,8 @@ class AclViewTest(LoginMixin, TestCase):
resp
=
c
.
post
(
"/dashboard/vm/1/acl/"
,
{
resp
=
c
.
post
(
"/dashboard/vm/1/acl/"
,
{
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'
perm-new-
name'
:
""
,
'name'
:
""
,
'
perm-new
'
:
""
,
'
level
'
:
""
,
})
})
self
.
assertTrue
((
self
.
u1
,
"user"
)
in
inst
.
get_users_with_level
())
self
.
assertTrue
((
self
.
u1
,
"user"
)
in
inst
.
get_users_with_level
())
self
.
assertEqual
(
resp
.
status_code
,
302
)
self
.
assertEqual
(
resp
.
status_code
,
302
)
...
@@ -1797,8 +1797,8 @@ class AclViewTest(LoginMixin, TestCase):
...
@@ -1797,8 +1797,8 @@ class AclViewTest(LoginMixin, TestCase):
inst
.
set_level
(
self
.
ut
,
"owner"
)
inst
.
set_level
(
self
.
ut
,
"owner"
)
resp
=
c
.
post
(
"/dashboard/vm/1/acl/"
,
{
resp
=
c
.
post
(
"/dashboard/vm/1/acl/"
,
{
'remove-u-
%
d'
%
self
.
ut
.
pk
:
""
,
'remove-u-
%
d'
%
self
.
ut
.
pk
:
""
,
'
perm-new-
name'
:
""
,
'name'
:
""
,
'
perm-new
'
:
""
,
'
level
'
:
""
,
})
})
self
.
assertEqual
(
self
.
ut
,
Instance
.
objects
.
get
(
id
=
1
)
.
owner
)
self
.
assertEqual
(
self
.
ut
,
Instance
.
objects
.
get
(
id
=
1
)
.
owner
)
self
.
assertTrue
((
self
.
ut
,
"owner"
)
in
inst
.
get_users_with_level
())
self
.
assertTrue
((
self
.
ut
,
"owner"
)
in
inst
.
get_users_with_level
())
...
@@ -1813,8 +1813,8 @@ class AclViewTest(LoginMixin, TestCase):
...
@@ -1813,8 +1813,8 @@ class AclViewTest(LoginMixin, TestCase):
resp
=
c
.
post
(
"/dashboard/template/1/acl/"
,
{
resp
=
c
.
post
(
"/dashboard/template/1/acl/"
,
{
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'
perm-new-
name'
:
""
,
'name'
:
""
,
'
perm-new
'
:
""
,
'
level
'
:
""
,
})
})
self
.
assertFalse
((
self
.
u1
,
"user"
)
in
tmpl
.
get_users_with_level
())
self
.
assertFalse
((
self
.
u1
,
"user"
)
in
tmpl
.
get_users_with_level
())
self
.
assertEqual
(
resp
.
status_code
,
302
)
self
.
assertEqual
(
resp
.
status_code
,
302
)
...
@@ -1827,8 +1827,8 @@ class AclViewTest(LoginMixin, TestCase):
...
@@ -1827,8 +1827,8 @@ class AclViewTest(LoginMixin, TestCase):
resp
=
c
.
post
(
"/dashboard/template/1/acl/"
,
{
resp
=
c
.
post
(
"/dashboard/template/1/acl/"
,
{
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'
perm-new-
name'
:
""
,
'name'
:
""
,
'
perm-new
'
:
""
,
'
level
'
:
""
,
})
})
self
.
assertTrue
((
self
.
u1
,
"user"
)
in
tmpl
.
get_users_with_level
())
self
.
assertTrue
((
self
.
u1
,
"user"
)
in
tmpl
.
get_users_with_level
())
self
.
assertEqual
(
resp
.
status_code
,
302
)
self
.
assertEqual
(
resp
.
status_code
,
302
)
...
@@ -1841,8 +1841,8 @@ class AclViewTest(LoginMixin, TestCase):
...
@@ -1841,8 +1841,8 @@ class AclViewTest(LoginMixin, TestCase):
tmpl
.
set_level
(
self
.
ut
,
"owner"
)
tmpl
.
set_level
(
self
.
ut
,
"owner"
)
resp
=
c
.
post
(
"/dashboard/template/1/acl/"
,
{
resp
=
c
.
post
(
"/dashboard/template/1/acl/"
,
{
'remove-u-
%
d'
%
self
.
ut
.
pk
:
""
,
'remove-u-
%
d'
%
self
.
ut
.
pk
:
""
,
'
perm-new-
name'
:
""
,
'name'
:
""
,
'
perm-new
'
:
""
,
'
level
'
:
""
,
})
})
self
.
assertEqual
(
self
.
ut
,
InstanceTemplate
.
objects
.
get
(
id
=
1
)
.
owner
)
self
.
assertEqual
(
self
.
ut
,
InstanceTemplate
.
objects
.
get
(
id
=
1
)
.
owner
)
self
.
assertTrue
((
self
.
ut
,
"owner"
)
in
tmpl
.
get_users_with_level
())
self
.
assertTrue
((
self
.
ut
,
"owner"
)
in
tmpl
.
get_users_with_level
())
...
...
circle/network/tests/test_views.py
View file @
6d5826d5
...
@@ -64,8 +64,8 @@ class VlanAclTest(LoginMixin, TestCase):
...
@@ -64,8 +64,8 @@ class VlanAclTest(LoginMixin, TestCase):
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/1/acl/"
,
{
'
perm-new-
name'
:
"user1"
,
'name'
:
"user1"
,
'
perm-new
'
:
"user"
,
'
level
'
:
"user"
,
})
})
vlan
=
Vlan
.
objects
.
get
(
vid
=
1
)
vlan
=
Vlan
.
objects
.
get
(
vid
=
1
)
...
@@ -82,8 +82,8 @@ class VlanAclTest(LoginMixin, TestCase):
...
@@ -82,8 +82,8 @@ class VlanAclTest(LoginMixin, TestCase):
resp
=
c
.
post
(
"/network/vlans/1/acl/"
,
{
resp
=
c
.
post
(
"/network/vlans/1/acl/"
,
{
'perm-u-
%
d'
%
self
.
u1
.
pk
:
"operator"
,
'perm-u-
%
d'
%
self
.
u1
.
pk
:
"operator"
,
'
perm-new
'
:
""
,
'
level
'
:
""
,
'
perm-new-
name'
:
""
,
'name'
:
""
,
})
})
self
.
assertTrue
((
self
.
u1
,
"operator"
)
in
vlan
.
get_users_with_level
())
self
.
assertTrue
((
self
.
u1
,
"operator"
)
in
vlan
.
get_users_with_level
())
...
@@ -99,8 +99,8 @@ class VlanAclTest(LoginMixin, TestCase):
...
@@ -99,8 +99,8 @@ class VlanAclTest(LoginMixin, TestCase):
resp
=
c
.
post
(
"/network/vlans/1/acl/"
,
{
resp
=
c
.
post
(
"/network/vlans/1/acl/"
,
{
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'remove-u-
%
d'
%
self
.
u1
.
pk
:
""
,
'
perm-new
'
:
""
,
'
level
'
:
""
,
'
perm-new-
name'
:
""
,
'name'
:
""
,
})
})
self
.
assertTrue
((
self
.
u1
,
"user"
)
not
in
vlan
.
get_users_with_level
())
self
.
assertTrue
((
self
.
u1
,
"user"
)
not
in
vlan
.
get_users_with_level
())
...
...
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