chore(settings): Remove old AppSettings model permission tests
ref: #855 #834
This commit is contained in:
@ -193,90 +193,6 @@ class ViewSetBase:
|
||||
)
|
||||
|
||||
|
||||
|
||||
class AppSettingsPermissionsAPI(
|
||||
ViewSetBase,
|
||||
APIPermissionChange,
|
||||
APIPermissionView,
|
||||
TestCase,
|
||||
):
|
||||
|
||||
|
||||
def test_returned_data_from_user_and_global_organizations_only(self):
|
||||
"""Check items returned
|
||||
|
||||
This test case is a over-ride of a test case with the same name.
|
||||
This model is not a tenancy model making this test not-applicable.
|
||||
|
||||
Items returned from the query Must be from the users organization and
|
||||
global ONLY!
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def test_add_create_not_allowed(self):
|
||||
""" Check correct permission for add
|
||||
|
||||
Not allowed to add.
|
||||
Ensure that the list view for HTTP/POST does not exist.
|
||||
"""
|
||||
|
||||
with pytest.raises(urls.exceptions.NoReverseMatch) as e:
|
||||
|
||||
url = reverse(self.app_namespace + ':' + self.url_name + '-list')
|
||||
|
||||
assert e.typename == 'NoReverseMatch'
|
||||
|
||||
|
||||
def test_change_different_organization_denied(self):
|
||||
""" Ensure permission view cant make change
|
||||
|
||||
This test case is N/A as app settings are not a tenancy model
|
||||
|
||||
Attempt to make change as user from different organization
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def test_delete_has_permission(self):
|
||||
""" Check correct permission for delete
|
||||
|
||||
Delete item as user with delete permission
|
||||
"""
|
||||
|
||||
client = Client()
|
||||
url = reverse(self.app_namespace + ':' + self.url_name + '-detail', kwargs=self.url_view_kwargs)
|
||||
|
||||
|
||||
client.force_login(self.delete_user)
|
||||
response = client.delete(url, data=self.delete_data)
|
||||
|
||||
assert response.status_code == 405
|
||||
|
||||
|
||||
def test_returned_results_only_user_orgs(self):
|
||||
"""Test not required
|
||||
|
||||
this test is not required as this model is not a tenancy model
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def test_view_different_organizaiton_denied(self):
|
||||
""" Check correct permission for view
|
||||
|
||||
This test case is N/A as app settings are not a tenancy model
|
||||
|
||||
Attempt to view with user from different organization
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class AppSettingsViewSet(
|
||||
ViewSetBase,
|
||||
SerializerChange,
|
||||
|
@ -198,133 +198,6 @@ class ViewSetBase:
|
||||
|
||||
|
||||
|
||||
# class UserSettingsPermissionsAPI(
|
||||
# ViewSetBase,
|
||||
# APIPermissionChange,
|
||||
# APIPermissionView,
|
||||
# TestCase,
|
||||
# ):
|
||||
|
||||
|
||||
# def test_returned_data_from_user_and_global_organizations_only(self):
|
||||
# """Check items returned
|
||||
|
||||
# This test case is a over-ride of a test case with the same name.
|
||||
# This model is not a tenancy model making this test not-applicable.
|
||||
|
||||
# Items returned from the query Must be from the users organization and
|
||||
# global ONLY!
|
||||
# """
|
||||
# pass
|
||||
|
||||
|
||||
|
||||
# # def test_add_create_not_allowed(self):
|
||||
# # """ Check correct permission for add
|
||||
|
||||
# # Not allowed to add.
|
||||
# # Ensure that the list view for HTTP/POST does not exist.
|
||||
# # """
|
||||
|
||||
# # with pytest.raises(urls.exceptions.NoReverseMatch) as e:
|
||||
|
||||
# # url = reverse(self.app_namespace + ':' + self.url_name + '-list')
|
||||
|
||||
# # assert e.typename == 'NoReverseMatch'
|
||||
|
||||
|
||||
|
||||
# def test_delete_has_permission(self):
|
||||
# """ Check correct permission for delete
|
||||
|
||||
# Delete item as user with delete permission
|
||||
# """
|
||||
|
||||
# client = Client()
|
||||
# url = reverse(self.app_namespace + ':' + self.url_name + '-detail', kwargs=self.url_view_kwargs)
|
||||
|
||||
|
||||
# client.force_login(self.view_user)
|
||||
# response = client.delete(url, data=self.delete_data)
|
||||
|
||||
# assert response.status_code == 405
|
||||
|
||||
|
||||
|
||||
# def test_change_has_permission(self):
|
||||
# """ Check correct permission for change
|
||||
|
||||
# Make change with user who has change permission
|
||||
# """
|
||||
|
||||
|
||||
# item = self.model.objects.get( id = self.change_user.id )
|
||||
|
||||
# item.default_organization = self.organization
|
||||
|
||||
# item.save()
|
||||
|
||||
# client = Client()
|
||||
# url = reverse(self.app_namespace + ':' + self.url_name + '-detail', kwargs={'pk': item.id})
|
||||
|
||||
|
||||
# client.force_login(self.change_user)
|
||||
# response = client.patch(url, data={'different_organization': self.different_organization.id}, content_type='application/json')
|
||||
|
||||
# assert response.status_code == 200
|
||||
|
||||
|
||||
# def test_change_permission_view_denied(self):
|
||||
# """ Ensure permission view cant make change
|
||||
|
||||
# This test case is a duplicate of a test case with the same name.
|
||||
# As this is the users own settings, any permission a user has will grant
|
||||
# them access as user settings do not use permissions
|
||||
|
||||
# Attempt to make change as user with view permission
|
||||
# """
|
||||
|
||||
# pass
|
||||
|
||||
|
||||
# def test_returned_results_only_user_orgs(self):
|
||||
# """Test not required
|
||||
|
||||
# this test is not required as this model is not a tenancy model
|
||||
# """
|
||||
|
||||
# pass
|
||||
|
||||
|
||||
# def test_change_no_permission_denied(self):
|
||||
# """ Ensure permission view cant make change
|
||||
|
||||
# This test case is a duplicate of a test case with the same name.
|
||||
# This test is not required for this model as there are no permissions
|
||||
# assosiated with accessing this model.
|
||||
|
||||
# Attempt to make change as user without permissions
|
||||
# """
|
||||
|
||||
# pass
|
||||
|
||||
|
||||
# def test_view_no_permission_denied(self):
|
||||
# """ Check correct permission for view
|
||||
|
||||
# This test case is a duplicate of a test case with the same name.
|
||||
# This test is not required for this model as there are no permissions
|
||||
# assosiated with accessing this model.
|
||||
|
||||
# Attempt to view with user missing permission
|
||||
# """
|
||||
|
||||
# pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class UserSettingsViewSet(
|
||||
ViewSetBase,
|
||||
SerializerChange,
|
||||
|
Reference in New Issue
Block a user