def METHOD_NAME(self, mocker):
    api_response = {"message": "error"}, 400
    mocker.patch(
        "pcluster.api.controllers.image_operations_controller.list_images",
        return_value=api_response,
        autospec=True,
    )
    with pytest.raises(APIOperationException) as exc_info:
        command = [
            "list-images",
            "--region",
            "eu-west-1",
            "--image-status",
            "AVAILABLE",
        ]
        run(command)
    assert_that(exc_info.value.data).is_equal_to(api_response[0])