|
3 | 3 |
|
4 | 4 | from django.contrib.auth.models import Permission |
5 | 5 | from django.contrib.contenttypes.models import ContentType |
6 | | -from django.shortcuts import reverse |
7 | | -from django.test import Client, TestCase |
8 | | -from django import urls |
| 6 | + |
| 7 | +from django.test import TestCase |
| 8 | +# from django import urls |
9 | 9 |
|
10 | 10 | from access.models.tenant import Tenant as Organization |
11 | 11 | from access.models.team import Team |
12 | 12 | from access.models.team_user import TeamUsers |
13 | 13 |
|
14 | | -from api.tests.abstract.api_permissions_viewset import ( |
15 | | - APIPermissionChange, |
16 | | - APIPermissionView |
17 | | -) |
| 14 | +# from api.tests.abstract.api_permissions_viewset import ( |
| 15 | +# APIPermissionChange, |
| 16 | +# APIPermissionView |
| 17 | +# ) |
18 | 18 | from api.tests.abstract.api_serializer_viewset import ( |
19 | 19 | SerializerChange, |
20 | 20 | SerializerView, |
|
31 | 31 |
|
32 | 32 |
|
33 | 33 |
|
| 34 | +@pytest.mark.functional |
| 35 | +@pytest.mark.model_usersettings |
| 36 | +@pytest.mark.module_settings |
34 | 37 | class ViewSetBase: |
35 | 38 |
|
36 | 39 | model = UserSettings |
@@ -195,128 +198,128 @@ def setUpTestData(self): |
195 | 198 |
|
196 | 199 |
|
197 | 200 |
|
198 | | -class UserSettingsPermissionsAPI( |
199 | | - ViewSetBase, |
200 | | - APIPermissionChange, |
201 | | - APIPermissionView, |
202 | | - TestCase, |
203 | | -): |
| 201 | +# class UserSettingsPermissionsAPI( |
| 202 | +# ViewSetBase, |
| 203 | +# APIPermissionChange, |
| 204 | +# APIPermissionView, |
| 205 | +# TestCase, |
| 206 | +# ): |
204 | 207 |
|
205 | 208 |
|
206 | | - def test_returned_data_from_user_and_global_organizations_only(self): |
207 | | - """Check items returned |
| 209 | +# def test_returned_data_from_user_and_global_organizations_only(self): |
| 210 | +# """Check items returned |
208 | 211 |
|
209 | | - This test case is a over-ride of a test case with the same name. |
210 | | - This model is not a tenancy model making this test not-applicable. |
| 212 | +# This test case is a over-ride of a test case with the same name. |
| 213 | +# This model is not a tenancy model making this test not-applicable. |
211 | 214 |
|
212 | | - Items returned from the query Must be from the users organization and |
213 | | - global ONLY! |
214 | | - """ |
215 | | - pass |
| 215 | +# Items returned from the query Must be from the users organization and |
| 216 | +# global ONLY! |
| 217 | +# """ |
| 218 | +# pass |
216 | 219 |
|
217 | 220 |
|
218 | 221 |
|
219 | | - def test_add_create_not_allowed(self): |
220 | | - """ Check correct permission for add |
| 222 | +# # def test_add_create_not_allowed(self): |
| 223 | +# # """ Check correct permission for add |
221 | 224 |
|
222 | | - Not allowed to add. |
223 | | - Ensure that the list view for HTTP/POST does not exist. |
224 | | - """ |
| 225 | +# # Not allowed to add. |
| 226 | +# # Ensure that the list view for HTTP/POST does not exist. |
| 227 | +# # """ |
225 | 228 |
|
226 | | - with pytest.raises(urls.exceptions.NoReverseMatch) as e: |
| 229 | +# # with pytest.raises(urls.exceptions.NoReverseMatch) as e: |
227 | 230 |
|
228 | | - url = reverse(self.app_namespace + ':' + self.url_name + '-list') |
| 231 | +# # url = reverse(self.app_namespace + ':' + self.url_name + '-list') |
229 | 232 |
|
230 | | - assert e.typename == 'NoReverseMatch' |
| 233 | +# # assert e.typename == 'NoReverseMatch' |
231 | 234 |
|
232 | 235 |
|
233 | 236 |
|
234 | | - def test_delete_has_permission(self): |
235 | | - """ Check correct permission for delete |
| 237 | +# def test_delete_has_permission(self): |
| 238 | +# """ Check correct permission for delete |
236 | 239 |
|
237 | | - Delete item as user with delete permission |
238 | | - """ |
| 240 | +# Delete item as user with delete permission |
| 241 | +# """ |
239 | 242 |
|
240 | | - client = Client() |
241 | | - url = reverse(self.app_namespace + ':' + self.url_name + '-detail', kwargs=self.url_view_kwargs) |
| 243 | +# client = Client() |
| 244 | +# url = reverse(self.app_namespace + ':' + self.url_name + '-detail', kwargs=self.url_view_kwargs) |
242 | 245 |
|
243 | 246 |
|
244 | | - client.force_login(self.view_user) |
245 | | - response = client.delete(url, data=self.delete_data) |
| 247 | +# client.force_login(self.view_user) |
| 248 | +# response = client.delete(url, data=self.delete_data) |
246 | 249 |
|
247 | | - assert response.status_code == 405 |
| 250 | +# assert response.status_code == 405 |
248 | 251 |
|
249 | 252 |
|
250 | 253 |
|
251 | | - def test_change_has_permission(self): |
252 | | - """ Check correct permission for change |
| 254 | +# def test_change_has_permission(self): |
| 255 | +# """ Check correct permission for change |
253 | 256 |
|
254 | | - Make change with user who has change permission |
255 | | - """ |
| 257 | +# Make change with user who has change permission |
| 258 | +# """ |
256 | 259 |
|
257 | 260 |
|
258 | | - item = self.model.objects.get( id = self.change_user.id ) |
| 261 | +# item = self.model.objects.get( id = self.change_user.id ) |
259 | 262 |
|
260 | | - item.default_organization = self.organization |
| 263 | +# item.default_organization = self.organization |
261 | 264 |
|
262 | | - item.save() |
| 265 | +# item.save() |
263 | 266 |
|
264 | | - client = Client() |
265 | | - url = reverse(self.app_namespace + ':' + self.url_name + '-detail', kwargs={'pk': item.id}) |
| 267 | +# client = Client() |
| 268 | +# url = reverse(self.app_namespace + ':' + self.url_name + '-detail', kwargs={'pk': item.id}) |
266 | 269 |
|
267 | 270 |
|
268 | | - client.force_login(self.change_user) |
269 | | - response = client.patch(url, data={'different_organization': self.different_organization.id}, content_type='application/json') |
| 271 | +# client.force_login(self.change_user) |
| 272 | +# response = client.patch(url, data={'different_organization': self.different_organization.id}, content_type='application/json') |
270 | 273 |
|
271 | | - assert response.status_code == 200 |
| 274 | +# assert response.status_code == 200 |
272 | 275 |
|
273 | 276 |
|
274 | | - def test_change_permission_view_denied(self): |
275 | | - """ Ensure permission view cant make change |
| 277 | +# def test_change_permission_view_denied(self): |
| 278 | +# """ Ensure permission view cant make change |
276 | 279 |
|
277 | | - This test case is a duplicate of a test case with the same name. |
278 | | - As this is the users own settings, any permission a user has will grant |
279 | | - them access as user settings do not use permissions |
| 280 | +# This test case is a duplicate of a test case with the same name. |
| 281 | +# As this is the users own settings, any permission a user has will grant |
| 282 | +# them access as user settings do not use permissions |
280 | 283 |
|
281 | | - Attempt to make change as user with view permission |
282 | | - """ |
| 284 | +# Attempt to make change as user with view permission |
| 285 | +# """ |
283 | 286 |
|
284 | | - pass |
| 287 | +# pass |
285 | 288 |
|
286 | 289 |
|
287 | | - def test_returned_results_only_user_orgs(self): |
288 | | - """Test not required |
| 290 | +# def test_returned_results_only_user_orgs(self): |
| 291 | +# """Test not required |
289 | 292 |
|
290 | | - this test is not required as this model is not a tenancy model |
291 | | - """ |
| 293 | +# this test is not required as this model is not a tenancy model |
| 294 | +# """ |
292 | 295 |
|
293 | | - pass |
| 296 | +# pass |
294 | 297 |
|
295 | 298 |
|
296 | | - def test_change_no_permission_denied(self): |
297 | | - """ Ensure permission view cant make change |
| 299 | +# def test_change_no_permission_denied(self): |
| 300 | +# """ Ensure permission view cant make change |
298 | 301 |
|
299 | | - This test case is a duplicate of a test case with the same name. |
300 | | - This test is not required for this model as there are no permissions |
301 | | - assosiated with accessing this model. |
| 302 | +# This test case is a duplicate of a test case with the same name. |
| 303 | +# This test is not required for this model as there are no permissions |
| 304 | +# assosiated with accessing this model. |
302 | 305 |
|
303 | | - Attempt to make change as user without permissions |
304 | | - """ |
| 306 | +# Attempt to make change as user without permissions |
| 307 | +# """ |
305 | 308 |
|
306 | | - pass |
| 309 | +# pass |
307 | 310 |
|
308 | 311 |
|
309 | | - def test_view_no_permission_denied(self): |
310 | | - """ Check correct permission for view |
| 312 | +# def test_view_no_permission_denied(self): |
| 313 | +# """ Check correct permission for view |
311 | 314 |
|
312 | | - This test case is a duplicate of a test case with the same name. |
313 | | - This test is not required for this model as there are no permissions |
314 | | - assosiated with accessing this model. |
| 315 | +# This test case is a duplicate of a test case with the same name. |
| 316 | +# This test is not required for this model as there are no permissions |
| 317 | +# assosiated with accessing this model. |
315 | 318 |
|
316 | | - Attempt to view with user missing permission |
317 | | - """ |
| 319 | +# Attempt to view with user missing permission |
| 320 | +# """ |
318 | 321 |
|
319 | | - pass |
| 322 | +# pass |
320 | 323 |
|
321 | 324 |
|
322 | 325 |
|
|
0 commit comments