Skip to content

Event Fallback

  • Back to Testing Overview

    Return to the Testing overview page with all topics.

    Back to Overview

Both classes are on invocations. The primary handler is entered, then the fallback.

See Event Handler Fallback.

def domain_events_mapper(mapper: cqrs.EventMap) -> None:
    mapper.bind(
        OrderCreated,
        cqrs.EventHandlerFallback(AuditHandler, AuditFallback),
    )

await harness.mediator.send(CreateOrder(sku="book"))
harness.invocations.assert_entered(AuditHandler)
harness.invocations.assert_entered(AuditFallback)

Library example: examples/testing/fallback.py.