Dataclass requests¶
-
Back to Testing Overview
Return to the Testing overview page with all topics.
requests.of(...).response is the object send returned. The harness adds no validator, so no validation record sits beside requests. This is the default path.
See Dataclasses.
async def test_dataclass_response_is_on_requests() -> None:
container = di.Container()
async with test_harness(container, commands_mapper=commands_mapper) as harness:
await harness.mediator.send(CreateOrder(sku="book"))
assert harness.requests.of(CreateOrder)[0].response == CreatedOrder(order_id="1")
Library example: examples/testing/test_command_and_query.py.