Refactor code structure for improved readability and maintainability

This commit is contained in:
k1nq
2026-09-16 14:27:32 +05:00
parent 01028f440e
commit 2b35fa9a6d
17 changed files with 1475 additions and 3 deletions
+31
View File
@@ -0,0 +1,31 @@
from typing import cast
from unittest.mock import AsyncMock
from faststream.rabbit import RabbitBroker
from app.messaging import (
DEAD_ROUTING_KEY,
PAYMENTS_ROUTING_KEY,
declare_topology,
)
async def test_declare_topology_binds_both_queues() -> None:
broker = AsyncMock()
payments_exchange = object()
dead_exchange = object()
payments_queue = AsyncMock()
dead_queue = AsyncMock()
broker.declare_exchange.side_effect = [payments_exchange, dead_exchange]
broker.declare_queue.side_effect = [payments_queue, dead_queue]
await declare_topology(cast(RabbitBroker, broker))
payments_queue.bind.assert_awaited_once_with(
payments_exchange,
routing_key=PAYMENTS_ROUTING_KEY,
)
dead_queue.bind.assert_awaited_once_with(
dead_exchange,
routing_key=DEAD_ROUTING_KEY,
)