Request Fallback¶
-
Back to Testing Overview
Return to the Testing overview page with all topics.
Both classes are on invocations. The response on requests is the fallback's.
def commands_mapper(mapper: cqrs.RequestMap) -> None:
mapper.bind(
CreateOrder,
cqrs.RequestHandlerFallback(CreateOrderHandler, CreateOrderFallback),
)
result = await harness.mediator.send(CreateOrder(sku="book"))
assert result.source == "fallback"
harness.invocations.assert_entered(CreateOrderHandler)
harness.invocations.assert_entered(CreateOrderFallback)
Library example: examples/testing/fallback.py.