Commit dbc6fe1d authored by George Papathanail's avatar George Papathanail
Browse files

test: wire callback_delivery_repo/port fixtures inf conftest.py

parent 5087b3c9
Loading
Loading
Loading
Loading
+23 −3
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ from tests.unit.fakes import (
    FakeCallbackRegistrationRepository,
    FakeDataBus,
    FakeOperationRepository,
    FakeQodCallbackDeliveryPort,
    FakeQodSessionRepository,
    FakeSRMClient,
    wire_operation_consumer,
@@ -128,6 +129,11 @@ def qod_session_repo() -> FakeQodSessionRepository:
    return FakeQodSessionRepository()


@pytest.fixture()
def qod_callback_delivery_port() -> FakeQodCallbackDeliveryPort:
    return FakeQodCallbackDeliveryPort()


@pytest.fixture()
def eam_service(
    fake_srm: FakeSRMClient,
@@ -152,10 +158,20 @@ def live_qod(
    fake_bus: FakeDataBus,
    operation_repo: FakeOperationRepository,
    qod_session_repo: FakeQodSessionRepository,
    callback_registration_repo: FakeCallbackRegistrationRepository,
    callback_delivery_repo: FakeCallbackDeliveryRepository,
    qod_callback_delivery_port: FakeQodCallbackDeliveryPort,
) -> None:
    """Wires QoD's real completion handler behind the fake bus, sharing the same
    operation_repo/qod_session_repo instances the api_client's qod_service writes to."""
    wire_qod_operation_consumer(fake_bus, operation_repo, qod_session_repo)
    """Wires QoD's real completion/status handlers behind the fake bus, sharing the
    same repo/port instances the api_client's qod_service writes to and delivers with."""
    wire_qod_operation_consumer(
        fake_bus,
        operation_repo,
        qod_session_repo,
        callback_registration_repo,
        callback_delivery_repo,
        qod_callback_delivery_port,
    )


@pytest.fixture()
@@ -165,6 +181,8 @@ def qod_service(
    operation_repo: FakeOperationRepository,
    qod_session_repo: FakeQodSessionRepository,
    callback_registration_repo: FakeCallbackRegistrationRepository,
    callback_delivery_repo: FakeCallbackDeliveryRepository,
    qod_callback_delivery_port: FakeQodCallbackDeliveryPort,
) -> QualityOnDemandService:
    return QualityOnDemandService(
        srm_client=fake_srm,
@@ -172,6 +190,8 @@ def qod_service(
        operation_repo=operation_repo,
        qod_session_repo=qod_session_repo,
        callback_registration_repo=callback_registration_repo,
        callback_delivery_repo=callback_delivery_repo,
        callback_delivery_port=qod_callback_delivery_port,
    )