Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
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
75b63279
authored
Mar 24, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: 404 for non existing templates
parent
5adcd0d9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
+7
-1
circle/dashboard/tests/test_views.py
+6
-0
circle/dashboard/views.py
+1
-1
No files found.
circle/dashboard/tests/test_views.py
View file @
75b63279
...
@@ -524,6 +524,12 @@ class VmDetailTest(LoginMixin, TestCase):
...
@@ -524,6 +524,12 @@ class VmDetailTest(LoginMixin, TestCase):
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
inst
.
status
,
'SUSPENDED'
)
self
.
assertEqual
(
inst
.
status
,
'SUSPENDED'
)
def
test_non_existing_template_get
(
self
):
c
=
Client
()
self
.
login
(
c
,
"superuser"
)
response
=
c
.
get
(
"/dashboard/template/111111/"
)
self
.
assertEqual
(
response
.
status_code
,
404
)
class
VmDetailVncTest
(
LoginMixin
,
TestCase
):
class
VmDetailVncTest
(
LoginMixin
,
TestCase
):
fixtures
=
[
'test-vm-fixture.json'
,
'node.json'
]
fixtures
=
[
'test-vm-fixture.json'
,
'node.json'
]
...
...
circle/dashboard/views.py
View file @
75b63279
...
@@ -801,7 +801,7 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
...
@@ -801,7 +801,7 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
success_message
=
_
(
"Successfully modified template!"
)
success_message
=
_
(
"Successfully modified template!"
)
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
template
=
InstanceTemplate
.
objects
.
get
(
pk
=
kwargs
[
'pk'
]
)
template
=
self
.
get_object
(
)
if
not
template
.
has_level
(
request
.
user
,
'user'
):
if
not
template
.
has_level
(
request
.
user
,
'user'
):
raise
PermissionDenied
()
raise
PermissionDenied
()
if
request
.
is_ajax
():
if
request
.
is_ajax
():
...
...
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