import pytest_asyncio from fastapi import Request from src.cache.redis_client import RedisClient from src.service.auth.auth import CurrentUserService @pytest_asyncio.fixture async def current_user_service(monkeypatch): test_redis = RedisClient() monkeypatch.setattr("src.service.auth.auth.redis_client", test_redis) service = CurrentUserService() yield service await test_redis.aclose() @pytest_asyncio.fixture async def requests(mocker): fake_request = mocker.MagicMock(spec=Request) fake_request.headers = {"user-agent": "pytest-agent", "x-forwarded-for":"127.0.0.1"} return fake_request