chore: initialize project repository

This commit is contained in:
Codex
2026-09-09 21:55:37 +08:00
commit b1497fd2c6
167 changed files with 17690 additions and 0 deletions
@@ -0,0 +1,23 @@
import pytest
from app.infrastructure.memory_cache import MemoryCacheAdapter
class FailingCache:
async def get(self, key: str) -> str:
raise ConnectionError("redis unavailable")
async def set(self, key: str, value: str, ex: int | None = None) -> None:
raise ConnectionError("redis unavailable")
@pytest.mark.asyncio
async def test_cache_read_degrades_without_raising() -> None:
result = await MemoryCacheAdapter(FailingCache()).get("memory:1")
assert result.value is None
assert result.degraded is True
@pytest.mark.asyncio
async def test_cache_write_failure_does_not_block_primary_store() -> None:
assert not await MemoryCacheAdapter(FailingCache()).set("memory:1", "value")