Reinstate OPTIONS tests

This commit is contained in:
Tom Christie 2014-11-13 16:24:03 +00:00
parent 502a86cedb
commit 9e75c4d8ea

View File

@ -95,59 +95,59 @@ class ModelPermissionsIntegrationTests(TestCase):
response = instance_view(request, pk=1) response = instance_view(request, pk=1)
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
# def test_options_permitted(self): def test_options_permitted(self):
# request = factory.options( request = factory.options(
# '/', '/',
# HTTP_AUTHORIZATION=self.permitted_credentials HTTP_AUTHORIZATION=self.permitted_credentials
# ) )
# response = root_view(request, pk='1') response = root_view(request, pk='1')
# self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertIn('actions', response.data) self.assertIn('actions', response.data)
# self.assertEqual(list(response.data['actions'].keys()), ['POST']) self.assertEqual(list(response.data['actions'].keys()), ['POST'])
# request = factory.options( request = factory.options(
# '/1', '/1',
# HTTP_AUTHORIZATION=self.permitted_credentials HTTP_AUTHORIZATION=self.permitted_credentials
# ) )
# response = instance_view(request, pk='1') response = instance_view(request, pk='1')
# self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertIn('actions', response.data) self.assertIn('actions', response.data)
# self.assertEqual(list(response.data['actions'].keys()), ['PUT']) self.assertEqual(list(response.data['actions'].keys()), ['PUT'])
# def test_options_disallowed(self): def test_options_disallowed(self):
# request = factory.options( request = factory.options(
# '/', '/',
# HTTP_AUTHORIZATION=self.disallowed_credentials HTTP_AUTHORIZATION=self.disallowed_credentials
# ) )
# response = root_view(request, pk='1') response = root_view(request, pk='1')
# self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertNotIn('actions', response.data) self.assertNotIn('actions', response.data)
# request = factory.options( request = factory.options(
# '/1', '/1',
# HTTP_AUTHORIZATION=self.disallowed_credentials HTTP_AUTHORIZATION=self.disallowed_credentials
# ) )
# response = instance_view(request, pk='1') response = instance_view(request, pk='1')
# self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertNotIn('actions', response.data) self.assertNotIn('actions', response.data)
# def test_options_updateonly(self): def test_options_updateonly(self):
# request = factory.options( request = factory.options(
# '/', '/',
# HTTP_AUTHORIZATION=self.updateonly_credentials HTTP_AUTHORIZATION=self.updateonly_credentials
# ) )
# response = root_view(request, pk='1') response = root_view(request, pk='1')
# self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertNotIn('actions', response.data) self.assertNotIn('actions', response.data)
# request = factory.options( request = factory.options(
# '/1', '/1',
# HTTP_AUTHORIZATION=self.updateonly_credentials HTTP_AUTHORIZATION=self.updateonly_credentials
# ) )
# response = instance_view(request, pk='1') response = instance_view(request, pk='1')
# self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertIn('actions', response.data) self.assertIn('actions', response.data)
# self.assertEqual(list(response.data['actions'].keys()), ['PUT']) self.assertEqual(list(response.data['actions'].keys()), ['PUT'])
class BasicPermModel(models.Model): class BasicPermModel(models.Model):