def test_remove_user_permission_file(change_to_test_directory): Permissions.PERMISSION_PATH = 'test_permissions_01.json' perms = Permissions(".") perms.add_user_permission("managerUser", "engineerUser", "users_write", "potato.obj") assert not perms.remove_user_permission("engineerUser", "engineerUser", "users_write", "potato.obj") assert perms.remove_user_permission("managerUser", "engineerUser", "users_write", "potato.obj") assert not perms.can_write("engineerUser", "potato.obj")
def test_remove_user_permission(change_to_test_directory): Permissions.PERMISSION_PATH = 'test_permissions_01.json' perms = Permissions(".") perms.add_user_permission("managerUser", "engineerUser", "users_write") assert not perms.remove_user_permission("engineerUser", "engineerUser", "users_write") assert perms.remove_user_permission("managerUser", "engineerUser", "users_write") assert not perms.can_write("engineerUser", "potato.obj") with pytest.raises(KeyError): perms.remove_user_permission("managerUser", "managerUser", "fakePermission")