Commit 6fe20d19 by Őry Máté

dashboard: small changes to match django1.6

parent 9741b9ed
...@@ -4,7 +4,6 @@ from unittest import skip ...@@ -4,7 +4,6 @@ from unittest import skip
from django.test import TestCase from django.test import TestCase
from django.test.client import Client from django.test.client import Client
from django.contrib.auth.models import User, Group from django.contrib.auth.models import User, Group
from django.core.exceptions import SuspiciousOperation
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from django.contrib.auth import authenticate from django.contrib.auth import authenticate
...@@ -897,8 +896,8 @@ class TransferOwnershipViewTest(LoginMixin, TestCase): ...@@ -897,8 +896,8 @@ class TransferOwnershipViewTest(LoginMixin, TestCase):
c2 = self.u2.notification_set.count() c2 = self.u2.notification_set.count()
c = Client() c = Client()
self.login(c, 'user2') self.login(c, 'user2')
with self.assertRaises(SuspiciousOperation): response = c.post('/dashboard/vm/1/tx/')
c.post('/dashboard/vm/1/tx/') assert response.status_code == 400
self.assertEqual(self.u2.notification_set.count(), c2) self.assertEqual(self.u2.notification_set.count(), c2)
def test_owned_offer(self): def test_owned_offer(self):
......
...@@ -30,9 +30,8 @@ from django.template import RequestContext ...@@ -30,9 +30,8 @@ from django.template import RequestContext
from django.forms.models import inlineformset_factory from django.forms.models import inlineformset_factory
from django_tables2 import SingleTableView from django_tables2 import SingleTableView
from braces.views import ( from braces.views import LoginRequiredMixin, SuperuserRequiredMixin
LoginRequiredMixin, SuperuserRequiredMixin, AccessMixin from braces.views._access import AccessMixin
)
from .forms import ( from .forms import (
CircleAuthenticationForm, DiskAddForm, HostForm, LeaseForm, MyProfileForm, CircleAuthenticationForm, DiskAddForm, HostForm, LeaseForm, MyProfileForm,
...@@ -504,6 +503,7 @@ class OperationView(DetailView): ...@@ -504,6 +503,7 @@ class OperationView(DetailView):
class VmOperationView(OperationView): class VmOperationView(OperationView):
model = Instance model = Instance
context_object_name = 'instance' # much simpler to mock object
class VmMigrateView(VmOperationView): class VmMigrateView(VmOperationView):
...@@ -2274,6 +2274,7 @@ def get_disk_download_status(request, pk): ...@@ -2274,6 +2274,7 @@ def get_disk_download_status(request, pk):
class InstanceActivityDetail(SuperuserRequiredMixin, DetailView): class InstanceActivityDetail(SuperuserRequiredMixin, DetailView):
model = InstanceActivity model = InstanceActivity
context_object_name = 'instanceactivity' # much simpler to mock object
template_name = 'dashboard/instanceactivity_detail.html' template_name = 'dashboard/instanceactivity_detail.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
......
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