test(settings): Exclude inter-org tests for model AppSettings

perms for appsettings are global

ref: #839 #834
This commit is contained in:
2025-06-17 15:15:06 +09:30
parent 5234051538
commit 41da9fb6a0
2 changed files with 76 additions and 22 deletions

View File

@ -42,6 +42,15 @@ class APIPermissionAddInheritedCases:
Attempt to add as user with no permissions
"""
if hasattr(self, 'exclude_permission_no_add'):
for name, reason in getattr(self, 'exclude_permission_no_add'):
if name == test_name:
pytest.xfail( reason = reason )
client = Client()
if user != 'anon':
@ -151,6 +160,14 @@ class APIPermissionChangeInheritedCases:
Attempt to make change as user without permissions
"""
if hasattr(self, 'exclude_permission_no_change'):
for name, reason in getattr(self, 'exclude_permission_no_change'):
if name == test_name:
pytest.xfail( reason = reason )
client = Client()
if user != 'anon':
@ -226,6 +243,14 @@ class APIPermissionDeleteInheritedCases:
Attempt to delete as user with no permissons
"""
if hasattr(self, 'exclude_permission_no_delete'):
for name, reason in getattr(self, 'exclude_permission_no_delete'):
if name == test_name:
pytest.xfail( reason = reason )
client = Client()
if user != 'anon':
@ -293,6 +318,14 @@ class APIPermissionViewInheritedCases:
Attempt to view with user missing permission
"""
if hasattr(self, 'exclude_permission_no_view'):
for name, reason in getattr(self, 'exclude_permission_no_view'):
if name == test_name:
pytest.xfail( reason = reason )
client = Client()
if user != 'anon':
@ -457,38 +490,38 @@ class APIPermissionsInheritedCases(
""" Test Suite for all API Permission test cases """
permission_no_add: list = []
# # permission_no_add: list = []
permission_no_change: list = []
# permission_no_change: list = []
permission_no_delete: list = []
# permission_no_delete: list = []
permission_no_view: list = []
# permission_no_view: list = []
@classmethod
def setup_class(self):
# @classmethod
# def setup_class(self):
self.permission_no_add = [
*super().permission_no_add,
*self.permission_no_add,
]
# # self.permission_no_add = [
# # *super().permission_no_add,
# # *self.permission_no_add,
# # ]
self.permission_no_change = [
*super().permission_no_change,
*self.permission_no_change,
]
# self.permission_no_change = [
# *super().permission_no_change,
# *self.permission_no_change,
# ]
self.permission_no_delete = [
*super().permission_no_delete,
*self.permission_no_delete,
]
# self.permission_no_delete = [
# *super().permission_no_delete,
# *self.permission_no_delete,
# ]
self.permission_no_view = [
*super().permission_no_view,
*self.permission_no_view,
]
# self.permission_no_view = [
# *super().permission_no_view,
# *self.permission_no_view,
# ]

View File

@ -0,0 +1,21 @@
class AdditionalTestCases:
exclude_permission_no_add = [
('different_organization_user_forbidden',
'Permission not restricted to orgs, they are app wide'),
]
exclude_permission_no_change = [
('different_organization_user_forbidden',
'Permission not restricted to orgs, they are app wide'),
]
exclude_permission_no_view = [
('different_organization_user_forbidden',
'Permission not restricted to orgs, they are app wide'),
]