Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
391c72e1
authored
Feb 27, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix disk add view tests
parent
3743cec7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
circle/dashboard/tests/test_views.py
+12
-4
circle/dashboard/urls.py
+1
-1
circle/dashboard/views.py
+1
-1
No files found.
circle/dashboard/tests/test_views.py
View file @
391c72e1
...
...
@@ -209,8 +209,12 @@ class VmDetailTest(TestCase):
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
.
set_level
(
self
.
u1
,
'owner'
)
disks
=
inst
.
disks
.
count
()
response
=
c
.
post
(
"/dashboard/vm/1/"
,
{
'disk-name'
:
"a"
,
'disk-size'
:
1
})
response
=
c
.
post
(
"/dashboard/disk/add/"
,
{
'disk-name'
:
"a"
,
'disk-size'
:
1
,
'disk-is_template'
:
0
,
'disk-object_pk'
:
1
,
})
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
disks
,
inst
.
disks
.
count
())
...
...
@@ -220,8 +224,12 @@ class VmDetailTest(TestCase):
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
.
set_level
(
self
.
u1
,
'owner'
)
disks
=
inst
.
disks
.
count
()
response
=
c
.
post
(
"/dashboard/vm/1/"
,
{
'disk-name'
:
"a"
,
'disk-size'
:
1
})
response
=
c
.
post
(
"/dashboard/disk/add/"
,
{
'disk-name'
:
"a"
,
'disk-size'
:
1
,
'disk-is_template'
:
0
,
'disk-object_pk'
:
1
,
})
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
disks
+
1
,
inst
.
disks
.
count
())
...
...
circle/dashboard/urls.py
View file @
391c72e1
...
...
@@ -88,6 +88,6 @@ urlpatterns = patterns(
url
(
r'^notifications/$'
,
NotificationView
.
as_view
(),
name
=
"dashboard.views.notifications"
),
url
(
r'^disk/add$'
,
DiskAddView
.
as_view
(),
url
(
r'^disk/add
/
$'
,
DiskAddView
.
as_view
(),
name
=
"dashboard.views.disk-add"
),
)
circle/dashboard/views.py
View file @
391c72e1
...
...
@@ -1708,7 +1708,7 @@ class VmMigrateView(SuperuserRequiredMixin, TemplateView):
return
redirect
(
"
%
s#activity"
%
vm
.
get_absolute_url
())
class
DiskAddView
(
SuperuserRequiredMixin
,
TemplateView
):
class
DiskAddView
(
TemplateView
):
def
post
(
self
,
*
args
,
**
kwargs
):
is_template
=
self
.
request
.
POST
.
get
(
"disk-is_template"
)
...
...
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