Commit e185ea3e by Őry Máté

dashboard: test GETs with invalid/expired tokens

parent 6dfa952b
...@@ -408,6 +408,8 @@ class RenewViewTest(LoginMixin, TestCase): ...@@ -408,6 +408,8 @@ class RenewViewTest(LoginMixin, TestCase):
filter(activity_code__endswith='renew').count() filter(activity_code__endswith='renew').count()
c = Client() c = Client()
self.login(c, 'user2') self.login(c, 'user2')
response = c.get(key)
self.assertEquals(response.status_code, 404)
response = c.post(key) response = c.post(key)
self.assertEquals(response.status_code, 404) self.assertEquals(response.status_code, 404)
ct2 = Instance.objects.get(pk=1).activity_log.\ ct2 = Instance.objects.get(pk=1).activity_log.\
...@@ -421,6 +423,8 @@ class RenewViewTest(LoginMixin, TestCase): ...@@ -421,6 +423,8 @@ class RenewViewTest(LoginMixin, TestCase):
filter(activity_code__endswith='renew').count() filter(activity_code__endswith='renew').count()
c = Client() c = Client()
self.login(c, 'user2') self.login(c, 'user2')
response = c.get(key)
self.assertEquals(response.status_code, 302)
response = c.post(key) response = c.post(key)
self.assertEquals(response.status_code, 403) self.assertEquals(response.status_code, 403)
ct2 = Instance.objects.get(pk=12).activity_log.\ ct2 = Instance.objects.get(pk=12).activity_log.\
......
...@@ -1662,7 +1662,7 @@ class AbstractVmFunctionView(AccessMixin, View): ...@@ -1662,7 +1662,7 @@ class AbstractVmFunctionView(AccessMixin, View):
user = User.objects.get(pk=user) user = User.objects.get(pk=user)
return user return user
def do_action(self, instance, user): def do_action(self, instance, user): # noqa
raise NotImplementedError('Please override do_action(instance, user)') raise NotImplementedError('Please override do_action(instance, user)')
def get_context(self, instance): def get_context(self, instance):
......
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