def test_superuser_access_to_preferences(access, target, expected): """ This checks user access. """ userid, role, action = access target_name, target_owner, target_visibility, target_sharedwith = target # load the default permissions model modpath = os.path.abspath(os.path.dirname(__file__)) permpath = os.path.abspath( os.path.join(modpath, "..", "default-permissions-model.json") ) assert ( permissions.load_policy_and_check_access( permpath, userid=userid, role=role, action=action, target_name=target_name, target_owner=target_owner, target_visibility=target_visibility, target_sharedwith=target_sharedwith, ) is expected )
def test_check_anonymous_access_to_preferences(access, target, expected): ''' This checks user access. ''' userid, role, action = access target_name, target_owner, target_visibility, target_sharedwith = target # load the default permissions model modpath = os.path.abspath(os.path.dirname(__file__)) permpath = os.path.abspath( os.path.join(modpath, '..', 'default-permissions-model.json')) assert permissions.load_policy_and_check_access( permpath, userid=userid, role=role, action=action, target_name=target_name, target_owner=target_owner, target_visibility=target_visibility, target_sharedwith=target_sharedwith) is expected