Files
group_fqcd_jr/tests/unit/service/test_health_service.py
T

16 lines
486 B
Python

import pytest
from app.service.health_service import HealthService
@pytest.mark.asyncio
async def test_redis_failure_marks_readiness_degraded(monkeypatch: pytest.MonkeyPatch) -> None:
async def unavailable(self: HealthService) -> bool:
return False
monkeypatch.setattr(HealthService, "_redis_ready", unavailable)
service = HealthService()
result = await service.ready()
assert result["checks"]["redis"] is False
assert result["status"] == "degraded"