def METHOD_NAME(stub_broker, cancel_backend, state_middleware, api_client):
    # Given a cancel backend
    # And a broker with the cancel middleware
    stub_broker.add_middleware(Cancel(backend=cancel_backend))
    # And an actor
    @remoulade.actor
    def do_work(arg=None):
        return 1
    # And those actors are declared
    stub_broker.declare_actor(do_work)
    message_to_cancel = do_work.message()
    # And a group that I enqueue
    g = group([message_to_cancel | do_work.message(), do_work.message()], cancel_on_error=True)
    g.run()
    # When I cancel a message of this group
    api_client.post("messages/cancel/" + message_to_cancel.message_id)
    # The whole composition should be canceled
    assert cancel_backend.is_canceled("", g.group_id)