Commit 391c72e1 by Kálmán Viktor

dashboard: fix disk add view tests

parent 3743cec7
...@@ -209,8 +209,12 @@ class VmDetailTest(TestCase): ...@@ -209,8 +209,12 @@ class VmDetailTest(TestCase):
inst = Instance.objects.get(pk=1) inst = Instance.objects.get(pk=1)
inst.set_level(self.u1, 'owner') inst.set_level(self.u1, 'owner')
disks = inst.disks.count() disks = inst.disks.count()
response = c.post("/dashboard/vm/1/", {'disk-name': "a", response = c.post("/dashboard/disk/add/", {
'disk-size': 1}) 'disk-name': "a",
'disk-size': 1,
'disk-is_template': 0,
'disk-object_pk': 1,
})
self.assertEqual(response.status_code, 403) self.assertEqual(response.status_code, 403)
self.assertEqual(disks, inst.disks.count()) self.assertEqual(disks, inst.disks.count())
...@@ -220,8 +224,12 @@ class VmDetailTest(TestCase): ...@@ -220,8 +224,12 @@ class VmDetailTest(TestCase):
inst = Instance.objects.get(pk=1) inst = Instance.objects.get(pk=1)
inst.set_level(self.u1, 'owner') inst.set_level(self.u1, 'owner')
disks = inst.disks.count() disks = inst.disks.count()
response = c.post("/dashboard/vm/1/", {'disk-name': "a", response = c.post("/dashboard/disk/add/", {
'disk-size': 1}) 'disk-name': "a",
'disk-size': 1,
'disk-is_template': 0,
'disk-object_pk': 1,
})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assertEqual(disks + 1, inst.disks.count()) self.assertEqual(disks + 1, inst.disks.count())
......
...@@ -88,6 +88,6 @@ urlpatterns = patterns( ...@@ -88,6 +88,6 @@ urlpatterns = patterns(
url(r'^notifications/$', NotificationView.as_view(), url(r'^notifications/$', NotificationView.as_view(),
name="dashboard.views.notifications"), name="dashboard.views.notifications"),
url(r'^disk/add$', DiskAddView.as_view(), url(r'^disk/add/$', DiskAddView.as_view(),
name="dashboard.views.disk-add"), name="dashboard.views.disk-add"),
) )
...@@ -1708,7 +1708,7 @@ class VmMigrateView(SuperuserRequiredMixin, TemplateView): ...@@ -1708,7 +1708,7 @@ class VmMigrateView(SuperuserRequiredMixin, TemplateView):
return redirect("%s#activity" % vm.get_absolute_url()) return redirect("%s#activity" % vm.get_absolute_url())
class DiskAddView(SuperuserRequiredMixin, TemplateView): class DiskAddView(TemplateView):
def post(self, *args, **kwargs): def post(self, *args, **kwargs):
is_template = self.request.POST.get("disk-is_template") is_template = self.request.POST.get("disk-is_template")
......
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