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
931ef81c
authored
Oct 14, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix lease delete tests
parent
75442927
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
circle/dashboard/tests/test_views.py
+1
-1
circle/dashboard/views/template.py
+3
-4
No files found.
circle/dashboard/tests/test_views.py
View file @
931ef81c
...
...
@@ -299,7 +299,7 @@ class VmDetailTest(LoginMixin, TestCase):
leases
=
Lease
.
objects
.
count
()
response
=
c
.
post
(
"/dashboard/lease/delete/1/"
)
# redirect to the login page
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
leases
,
Lease
.
objects
.
count
())
def
test_notification_read
(
self
):
...
...
circle/dashboard/views/template.py
View file @
931ef81c
...
...
@@ -471,10 +471,9 @@ class LeaseDelete(LoginRequiredMixin, DeleteView):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
object
=
self
.
get_object
()
# if there are still templates with this lease
# or the user is not owner
if
(
object
.
instancetemplate_set
.
count
()
>
0
or
not
object
.
has_level
(
request
.
user
,
"owner"
)):
if
not
object
.
has_level
(
request
.
user
,
"owner"
):
raise
PermissionDenied
()
if
object
.
instancetemplate_set
.
count
()
>
0
:
raise
SuspiciousOperation
()
object
.
delete
()
...
...
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