fix: 단풍 지도 남이섬 중복 제거(67곳), 날짜 따라 깨지던 노을 칸·방위각 테스트를 계절과 상관없이 맞게
This commit is contained in:
1 parent
746aa4ba92
commit
882c7f06dc
5 files changed
+12
-15
No files matched your search
@@ -49,7 +49,8 @@ async def test_sky_view_scores_three_days_with_spots(monkeypatch, clean):
|
||||
assert body["sunset"]["confidence"] == 1
|
||||
assert len(body["days"]) == 3
|
||||
assert [s["name"] for s in body["spots"]] == ["망원한강공원", "선유도공원", "하늘공원"]
|
||||
assert 255 <= body["sunset_azimuth"] <= 280
|
||||
# 서울 해 지는 방위는 한 해 동안 240°(동지)~300°(하지) 사이
|
||||
assert 240 <= body["sunset_azimuth"] <= 300
|
||||
plan = body["plan"]
|
||||
assert plan["verdict"] == "go" and plan["headline"] == "나가 볼 만해요" and plan["when"] in ("오늘", "내일")
|
||||
assert "적당히" in plan["reason"]
|
||||
|
||||
@@ -8,7 +8,9 @@ from sqlalchemy import text
|
||||
import services.weather_service as weather_service
|
||||
from common.cache.redis_client import REDIS
|
||||
from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.utils.kma_time import kst_midnight, latest_vilage_base, now_kst
|
||||
from common.utils.kma_time import KST, kst_midnight, latest_vilage_base, now_kst
|
||||
from crud.region_crud import RegionCRUD
|
||||
from services.calc.sun import sun_times
|
||||
from services.external.kma import day_start_base
|
||||
from router.router import app
|
||||
|
||||
@@ -57,7 +59,11 @@ async def test_today_fetches_stores_and_returns_8_slots(monkeypatch, clean_regio
|
||||
assert [s["label"] for s in body["slots"]] == ["0시", "3시", "6시", "9시", "12시", "15시", "18시", "21시"]
|
||||
assert all(s["temp_c"] == 18 for s in body["slots"])
|
||||
assert body["slots"][0]["icon"] == "moon"
|
||||
assert body["slots"][6]["icon"] == "sunset" and body["slots"][6]["note"] == "노을"
|
||||
# 해 지는 시각이 든 3시간 칸이 노을 (여름엔 18시 칸, 늦가을·겨울엔 15시 칸)
|
||||
_, region = await DB_SESSION_MNG.execute_lambda(lambda s: RegionCRUD().get(s, REGION))
|
||||
at = sun_times(now_kst().date(), float(region.lat), float(region.lon)).sunset_at.astimezone(KST)
|
||||
dusk = body["slots"][at.hour // 3]
|
||||
assert dusk["icon"] == "sunset" and dusk["note"] == "노을"
|
||||
assert len(calls) == 2
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user