feat: 워치 스킨 가운데를 날씨 따라 비구름·천둥 구름·눈구름으로 — 초단기예보 낙뢰(LGT)로 2시간 안 천둥을 워치에 알림

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
HyeongBaeYangandClaude Opus 5.5 committed 2026-10-13 11:00:39 +09:00
1 parent a74e3b49d0
commit c0e0363759
10 files changed
+236 -37

No files matched your search

+17
View File
@@ -4,7 +4,9 @@ from types import SimpleNamespace
import pytest
from httpx import ASGITransport, AsyncClient
import services.now_service as now_service
import services.week_service as week_service
from common.cache.redis_client import REDIS
from common.utils.kma_time import KST, now_kst
from router.router import app
from router.v1.watch.watch import timeline
@@ -83,3 +85,18 @@ async def test_watch_summary_unknown_region_fails(offline):
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
body = (await client.get("/v1/watch/summary", params={"region": "0000000000"})).json()
assert body["result"]["success"] is False
@pytest.mark.anyio
async def test_watch_summary_flags_thunder_within_2_hours(offline, monkeypatch):
start = now_kst().replace(minute=0, second=0, microsecond=0)
items = [
{"category": c, "fcstDate": (start + timedelta(hours=h)).strftime("%Y%m%d"), "fcstTime": (start + timedelta(hours=h)).strftime("%H%M"), "fcstValue": v}
for h in range(1, 7) for c, v in [("PTY", "1"), ("RN1", "5.0mm"), ("T1H", "20"), ("LGT", "2" if h == 1 else "0")]
]
monkeypatch.setattr(now_service, "fetch_ultra", lambda *a: _async(items))
# 앞 테스트가 받아 둔 초단기예보 캐시(비 없음)를 지워야 새 예보를 읽는다
await REDIS.conn.delete(f"ultra:{REGION}", f"lock:ultra:{REGION}")
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
body = (await client.get("/v1/watch/summary", params={"region": REGION})).json()
assert body["now"]["rain_2h"] is True and body["now"]["thunder"] is True