def test_remove_role_permission_file(change_to_test_directory): Permissions.PERMISSION_PATH = 'test_permissions_01.json' perms = Permissions(".") perms.add_role_permission("managerUser", "engineer", "roles_write", "potato.obj") assert not perms.remove_role_permission("engineerUser", "engineer", "roles_write", "potato.obj") assert perms.remove_role_permission("managerUser", "engineer", "roles_write", "potato.obj") assert not perms.can_write("engineerUser", "potato.obj")
def test_remove_role_permission(change_to_test_directory): Permissions.PERMISSION_PATH = 'test_permissions_01.json' perms = Permissions(".") perms.add_role_permission("managerUser", "engineer", "roles_write") assert not perms.remove_role_permission("engineerUser", "engineer", "roles_write") assert perms.remove_role_permission("managerUser", "engineer", "roles_write") assert not perms.can_write("engineerUser", "anything.py") assert not perms.remove_role_permission("managerUser", "fakeRole", "roles_write") with pytest.raises(KeyError): perms.remove_role_permission("managerUser", "manager", "fakePermission")