import asyncio
from faststream.rabbit import RabbitBroker, TestRabbitBroker
import pytest

from . import custom_wait_for_reply


@pytest.mark.skip("Skipped due to requiring real rabbit broker")
async def test_custom_wait_for_reply():
    broker = RabbitBroker("amqp://localhost")
    expected = {"a": 1}

    @broker.subscriber("first")
    async def test_subscriber():
        return expected

    async with TestRabbitBroker(broker, with_real=True) as tbr:
        async with asyncio.timeout(0.5):
            result = await custom_wait_for_reply(tbr, queue="first")

    assert result == expected
