dependency-injector¶
-
Back to Testing Overview
Return to the Testing overview page with all topics.
The harness does not import dependency-injector. The adapter does not implement SupportsScope, so scope_strategy is not SEND. Read requests. A shared session on invocations stays absent.
See Dependency injection.
from cqrs.container.dependency_injector import DependencyInjectorCQRSContainer
mediator = bootstrap.bootstrap(
di_container=DependencyInjectorCQRSContainer(container),
commands_mapper=commands_mapper,
)
async with test_harness.around(mediator) as harness:
await mediator.send(CreateOrder(sku="book"))
assert harness.requests.contains(CreateOrder)
Library example: examples/testing/dependency_injector_container.py.