Commit 931ef81c by Kálmán Viktor

dashboard: fix lease delete tests

parent 75442927
......@@ -299,7 +299,7 @@ class VmDetailTest(LoginMixin, TestCase):
leases = Lease.objects.count()
response ="/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):
......@@ -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()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment