feat: 10/21 회의 반영 — 공유 링크·로그인 없이 댓글·구글 로그인만, 히어로·오늘의 각 좋아요·댓글, 히어로 오늘/내일 스위치, 단풍 지도 65곳·3단계
- 공유: 이미지와 함께 고정 URL을 넘기고 링크도 클립보드에 복사 - 로그인 창은 구글만, 댓글은 로그인 없이 '동네 익명'(링크·전화번호 막기, IP당 하루 20개, 같은 IP만 지우기) - 히어로·오늘의 각 카드에 좋아요·댓글 (PostType HERO·TODAY_GAK) - 히어로 오늘/내일 스위치: 내일 구간별 날씨 점수·기온·최저최고·습도·1위 각, /v1/weather/today?day=tomorrow - 단풍 지도: 단풍 그림 지도, 단풍 전·첫 단풍·절정, 단풍잎·은행잎, 명소 65곳(산림청 예측 + 가까운 지점 날짜) - 하단 탭 바 불투명 (홈 바 자리로 글이 비치지 않게) - 사람 글 동네 우선 정렬·내 글 목록, 내 각 '있는 각에서 불러오기' - 댓글 표 user_id NULL 허용·ip_hash·region_name (운영 DB ALTER 필요)
This commit is contained in:
1 parent
14f24d1ab0
commit
93e041bb91
46 files changed
+1820
-337
No files matched your search
@@ -85,3 +85,65 @@ async def test_anon_talk_like():
|
||||
assert next(x for x in talks if x["talk_id"] == talk_id)["liked"] is False
|
||||
|
||||
assert (await c.delete(url, headers=IP_A)).json()["like_count"] == 2
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_anon_comment_shows_region_and_only_same_ip_deletes(offline):
|
||||
async with client() as c:
|
||||
post_id = (await c.get("/v1/feed", params={"region": REGION})).json()["posts"][0]["post_id"]
|
||||
url = f"/v1/reaction/post/{post_id}/comment"
|
||||
made = (await c.post(url, headers=IP_A, json={"body": " 우산 챙겨요 ", "region": REGION})).json()["comment"]
|
||||
assert made["body"] == "우산 챙겨요" and made["nickname"] == "마포구 익명" and made["mine"] is True
|
||||
assert (await c.post(url, headers=IP_A, json={"body": "www.example.com 보세요"})).json()["result"]["desc"] == "LINK_NOT_ALLOWED"
|
||||
no_region = (await c.post(url, headers=IP_A, json={"body": "안녕"})).json()["comment"]
|
||||
assert no_region["nickname"] == "익명"
|
||||
|
||||
listed = (await c.get(f"{url}/list", headers=IP_B)).json()["comments"]
|
||||
assert [(x["nickname"], x["mine"]) for x in listed] == [("마포구 익명", False), ("익명", False)]
|
||||
assert next(x for x in (await c.get(f"{url}/list", headers=IP_A)).json()["comments"] if x["comment_id"] == made["comment_id"])["mine"] is True
|
||||
|
||||
h = await _login(c, "anon_cmt_01")
|
||||
delete = f"/v1/reaction/comment/{made['comment_id']}"
|
||||
assert (await c.delete(delete, headers=IP_B)).json()["result"]["desc"] == "NOT_FOUND"
|
||||
assert (await c.delete(delete, headers={**h, **IP_A})).json()["result"]["desc"] == "NOT_FOUND"
|
||||
assert (await c.delete(delete, headers=IP_A)).json()["result"]["success"] is True
|
||||
feed = (await c.get("/v1/feed", params={"region": REGION})).json()
|
||||
assert next(x for x in feed["posts"] if x["post_id"] == post_id)["comment_count"] == 1
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_anon_comment_daily_limit_per_ip(offline):
|
||||
async with client() as c:
|
||||
post_id = (await c.get("/v1/feed", params={"region": REGION})).json()["posts"][0]["post_id"]
|
||||
url = f"/v1/reaction/post/{post_id}/comment"
|
||||
ip = {"X-Forwarded-For": "203.0.113.40"}
|
||||
for i in range(20):
|
||||
assert (await c.post(url, headers=ip, json={"body": f"댓글{i}"})).json()["result"]["success"] is True
|
||||
assert (await c.post(url, headers=ip, json={"body": "하나 더"})).json()["result"]["desc"] == "DAILY_LIMIT"
|
||||
assert (await c.post(url, headers=IP_B, json={"body": "다른 사람"})).json()["result"]["success"] is True
|
||||
h = await _login(c, "anon_cmt_02")
|
||||
assert (await c.post(url, headers={**h, **ip}, json={"body": "로그인하면 따로"})).json()["result"]["success"] is True
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_hero_and_today_gak_take_likes_and_comments(offline):
|
||||
async with client() as c:
|
||||
feed = (await c.get("/v1/feed", params={"region": REGION})).json()
|
||||
hero, gak = feed["hero_post"]["post_id"], feed["gak_post"]["post_id"]
|
||||
assert hero != gak and {hero, gak}.isdisjoint(p["post_id"] for p in feed["posts"])
|
||||
assert (await c.post(f"/v1/reaction/post/{hero}/like", headers=IP_A)).json()["like_count"] == 1
|
||||
assert (await c.post(f"/v1/reaction/post/{gak}/comment", headers=IP_A, json={"body": "좋다"})).json()["result"]["success"] is True
|
||||
|
||||
mine = (await c.get("/v1/feed", params={"region": REGION}, headers=IP_A)).json()
|
||||
assert mine["hero_post"] == {"post_id": hero, "like_count": 1, "comment_count": 0, "liked": True}
|
||||
assert mine["gak_post"] == {"post_id": gak, "like_count": 0, "comment_count": 1, "liked": False}
|
||||
assert (await c.get("/v1/feed", params={"region": REGION}, headers=IP_B)).json()["hero_post"]["liked"] is False
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_hero_tomorrow_and_tomorrow_slots(offline):
|
||||
async with client() as c:
|
||||
hero = (await c.get("/v1/feed", params={"region": REGION})).json()["hero"]
|
||||
assert set(hero["tomorrow"]["weather_slots"]) <= {"morning", "day", "evening", "night"}
|
||||
res = (await c.get("/v1/weather/today", params={"region": REGION, "day": "tomorrow"})).json()
|
||||
assert res["day"] == hero["tomorrow"]["day"]
|
||||
Reference in new issue
Block a user