@@ -95,59 +95,59 @@ def test_does_not_have_delete_permissions(self):
95
95
response = instance_view (request , pk = 1 )
96
96
self .assertEqual (response .status_code , status .HTTP_403_FORBIDDEN )
97
97
98
- # def test_options_permitted(self):
99
- # request = factory.options(
100
- # '/',
101
- # HTTP_AUTHORIZATION=self.permitted_credentials
102
- # )
103
- # response = root_view(request, pk='1')
104
- # self.assertEqual(response.status_code, status.HTTP_200_OK)
105
- # self.assertIn('actions', response.data)
106
- # self.assertEqual(list(response.data['actions'].keys()), ['POST'])
107
-
108
- # request = factory.options(
109
- # '/1',
110
- # HTTP_AUTHORIZATION=self.permitted_credentials
111
- # )
112
- # response = instance_view(request, pk='1')
113
- # self.assertEqual(response.status_code, status.HTTP_200_OK)
114
- # self.assertIn('actions', response.data)
115
- # self.assertEqual(list(response.data['actions'].keys()), ['PUT'])
116
-
117
- # def test_options_disallowed(self):
118
- # request = factory.options(
119
- # '/',
120
- # HTTP_AUTHORIZATION=self.disallowed_credentials
121
- # )
122
- # response = root_view(request, pk='1')
123
- # self.assertEqual(response.status_code, status.HTTP_200_OK)
124
- # self.assertNotIn('actions', response.data)
125
-
126
- # request = factory.options(
127
- # '/1',
128
- # HTTP_AUTHORIZATION=self.disallowed_credentials
129
- # )
130
- # response = instance_view(request, pk='1')
131
- # self.assertEqual(response.status_code, status.HTTP_200_OK)
132
- # self.assertNotIn('actions', response.data)
133
-
134
- # def test_options_updateonly(self):
135
- # request = factory.options(
136
- # '/',
137
- # HTTP_AUTHORIZATION=self.updateonly_credentials
138
- # )
139
- # response = root_view(request, pk='1')
140
- # self.assertEqual(response.status_code, status.HTTP_200_OK)
141
- # self.assertNotIn('actions', response.data)
142
-
143
- # request = factory.options(
144
- # '/1',
145
- # HTTP_AUTHORIZATION=self.updateonly_credentials
146
- # )
147
- # response = instance_view(request, pk='1')
148
- # self.assertEqual(response.status_code, status.HTTP_200_OK)
149
- # self.assertIn('actions', response.data)
150
- # self.assertEqual(list(response.data['actions'].keys()), ['PUT'])
98
+ def test_options_permitted (self ):
99
+ request = factory .options (
100
+ '/' ,
101
+ HTTP_AUTHORIZATION = self .permitted_credentials
102
+ )
103
+ response = root_view (request , pk = '1' )
104
+ self .assertEqual (response .status_code , status .HTTP_200_OK )
105
+ self .assertIn ('actions' , response .data )
106
+ self .assertEqual (list (response .data ['actions' ].keys ()), ['POST' ])
107
+
108
+ request = factory .options (
109
+ '/1' ,
110
+ HTTP_AUTHORIZATION = self .permitted_credentials
111
+ )
112
+ response = instance_view (request , pk = '1' )
113
+ self .assertEqual (response .status_code , status .HTTP_200_OK )
114
+ self .assertIn ('actions' , response .data )
115
+ self .assertEqual (list (response .data ['actions' ].keys ()), ['PUT' ])
116
+
117
+ def test_options_disallowed (self ):
118
+ request = factory .options (
119
+ '/' ,
120
+ HTTP_AUTHORIZATION = self .disallowed_credentials
121
+ )
122
+ response = root_view (request , pk = '1' )
123
+ self .assertEqual (response .status_code , status .HTTP_200_OK )
124
+ self .assertNotIn ('actions' , response .data )
125
+
126
+ request = factory .options (
127
+ '/1' ,
128
+ HTTP_AUTHORIZATION = self .disallowed_credentials
129
+ )
130
+ response = instance_view (request , pk = '1' )
131
+ self .assertEqual (response .status_code , status .HTTP_200_OK )
132
+ self .assertNotIn ('actions' , response .data )
133
+
134
+ def test_options_updateonly (self ):
135
+ request = factory .options (
136
+ '/' ,
137
+ HTTP_AUTHORIZATION = self .updateonly_credentials
138
+ )
139
+ response = root_view (request , pk = '1' )
140
+ self .assertEqual (response .status_code , status .HTTP_200_OK )
141
+ self .assertNotIn ('actions' , response .data )
142
+
143
+ request = factory .options (
144
+ '/1' ,
145
+ HTTP_AUTHORIZATION = self .updateonly_credentials
146
+ )
147
+ response = instance_view (request , pk = '1' )
148
+ self .assertEqual (response .status_code , status .HTTP_200_OK )
149
+ self .assertIn ('actions' , response .data )
150
+ self .assertEqual (list (response .data ['actions' ].keys ()), ['PUT' ])
151
151
152
152
153
153
class BasicPermModel (models .Model ):
0 commit comments