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
d3808ba3
authored
Jan 27, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix tests
parent
ee6f3995
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
circle/dashboard/fixtures/test-vm-fixture.json
+1
-1
circle/dashboard/tests/test_views.py
+5
-2
No files found.
circle/dashboard/fixtures/test-vm-fixture.json
View file @
d3808ba3
...
@@ -1385,7 +1385,7 @@
...
@@ -1385,7 +1385,7 @@
}
}
},
},
{
{
"pk"
:
1
,
"pk"
:
2
,
"model"
:
"firewall.vlan"
,
"model"
:
"firewall.vlan"
,
"fields"
:
{
"fields"
:
{
"comment"
:
""
,
"comment"
:
""
,
...
...
circle/dashboard/tests/test_views.py
View file @
d3808ba3
...
@@ -3,6 +3,7 @@ from django.test.client import Client
...
@@ -3,6 +3,7 @@ from django.test.client import Client
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.models
import
User
,
Group
from
vm.models
import
Instance
from
vm.models
import
Instance
from
firewall.models
import
Vlan
class
VmDetailTest
(
TestCase
):
class
VmDetailTest
(
TestCase
):
...
@@ -127,15 +128,17 @@ class VmDetailTest(TestCase):
...
@@ -127,15 +128,17 @@ class VmDetailTest(TestCase):
self
.
login
(
c
,
"user1"
)
self
.
login
(
c
,
"user1"
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
.
set_level
(
self
.
u1
,
'owner'
)
inst
.
set_level
(
self
.
u1
,
'owner'
)
vlan
=
Vlan
.
objects
.
get
(
id
=
1
)
vlan
.
set_level
(
self
.
u1
,
'user'
)
interface_count
=
inst
.
interface_set
.
count
()
interface_count
=
inst
.
interface_set
.
count
()
response
=
c
.
post
(
"/dashboard/vm/1/"
,
response
=
c
.
post
(
"/dashboard/vm/1/"
,
{
'new_network_vlan'
:
1
,
'managed'
:
'on'
})
{
'new_network_vlan'
:
1
})
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
inst
.
interface_set
.
count
(),
interface_count
+
1
)
self
.
assertEqual
(
inst
.
interface_set
.
count
(),
interface_count
+
1
)
def
test_create_vm_w_unpermitted_network
(
self
):
def
test_create_vm_w_unpermitted_network
(
self
):
c
=
Client
()
c
=
Client
()
self
.
login
(
c
,
'user
1
'
)
self
.
login
(
c
,
'user
2
'
)
response
=
c
.
post
(
'/dashboard/vm/create/'
,
response
=
c
.
post
(
'/dashboard/vm/create/'
,
{
'template'
:
1
,
{
'template'
:
1
,
'cpu_priority'
:
1
,
'cpu_count'
:
1
,
'cpu_priority'
:
1
,
'cpu_count'
:
1
,
...
...
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