Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

JSON messages

  • Back to Testing Overview

    Return to the Testing overview page with all topics.

    Back to Overview

published is the default path. content_type is None, and payload["event_name"] is "order_created". handled stays empty.

See Outbox usage.

async def test_notification_is_published_as_json() -> None:
    container = di.Container()
    async with test_harness(container, commands_mapper=commands_mapper) as harness:
        await harness.mediator.send(CreateOrder(sku="book"))

        message = harness.published.one(OrderCreatedNotice)
        assert message.content_type is None
        assert message.payload["event_name"] == "order_created"

Library example: examples/testing/test_domain_and_notification.py.