feat: 워치에 주변 축제 표시 (앱 축제 장, 스킨 날짜 밑 한 줄)
- /v1/watch/summary 에 events 2개: 진행 중 먼저, 이름 앞 [주최] 괄호 제거, 4초 넘으면 축제만 빼고 응답 - 앱: 내 각 다음에 근처 축제 장 (이름 · 상태 · 장소와 그날 날씨) - 스킨: 날짜 밑 "🎉 주변 축제 · 이름" 한 줄 (EventComplicationService, LONG_TEXT, 행사 없으면 숨김) - 스킨 배치: 해 구슬 162→136, 해·링 묶음 24px 아래로, 기온·비 칩 y 366 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a6a738ae61
commit
b4d028a91b
10 files changed
+208
-46
No files matched your search
@@ -4,7 +4,8 @@ from types import SimpleNamespace
|
||||
import pytest
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
from common.utils.kma_time import KST
|
||||
import services.week_service as week_service
|
||||
from common.utils.kma_time import KST, now_kst
|
||||
from router.router import app
|
||||
from router.v1.watch.watch import timeline
|
||||
|
||||
@@ -12,6 +13,10 @@ REGION = "1141000000"
|
||||
SUN = datetime(2026, 10, 6, 18, 0, tzinfo=KST)
|
||||
|
||||
|
||||
async def _async(v):
|
||||
return v
|
||||
|
||||
|
||||
def _sunset(score: int) -> SimpleNamespace:
|
||||
return SimpleNamespace(score=score, best_times=[
|
||||
{"at": SUN.isoformat(), "kind": "sun", "label": "해 져요"},
|
||||
@@ -53,6 +58,21 @@ async def test_watch_summary_bundles_now_top_picks_sunset(offline):
|
||||
assert body["sunset"]["best_at"] > body["sunset"]["sunset_at"]
|
||||
assert all(s["at"] > body["issued_at"] for s in body["slots"])
|
||||
assert body["timeline"][0]["start_at"] == body["issued_at"]
|
||||
assert [(e["name"], e["status_label"]) for e in body["events"]] == [("테스트 축제", "진행 중")]
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_watch_summary_puts_live_event_first_without_bracket_prefix(offline, monkeypatch):
|
||||
# 서버 순서는 시작일이 가까운 순이라 내일 시작이 먼저지만, 스킨에 하나만 띄우니 진행 중을 앞으로. 이름 앞 [주최] 는 뺀다
|
||||
today = now_kst().date()
|
||||
day = lambda n: (today + timedelta(days=n)).strftime("%Y%m%d")
|
||||
monkeypatch.setattr(week_service, "fetch_festivals", lambda c, sido, since: _async([
|
||||
{"contentid": "1", "title": "내일 축제", "addr1": "서울", "eventstartdate": day(1), "eventenddate": day(2)},
|
||||
{"contentid": "2", "title": "[주최] 열리는 축제", "addr1": "서울", "eventstartdate": day(-3), "eventenddate": day(2)},
|
||||
] if sido == "11" else []))
|
||||
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 [e["name"] for e in body["events"]] == ["열리는 축제", "내일 축제"]
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
|
||||
Reference in new issue
Block a user