- 각 점수: 편한 범위 안에서도 최적값에서만 100, 가장 나쁜 요인이 전체를 끌어내림 - 피드 노을 시간대 각 정렬 오류 수정 - 주말 카드 매일 노출, 예보가 닿으면 다음 주말 슬라이드 추가, 주말·행사 탭 열흘 - 지역 256→230 (일반구 39개를 시 13개로) - 회의 기록과 TODO.md 추가
45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
import pytest
|
|
from httpx import ASGITransport, AsyncClient
|
|
|
|
from router.router import app
|
|
|
|
|
|
async def _get(path: str, **params):
|
|
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
|
|
return (await client.get(path, params=params)).json()
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_region_list_is_seoul_gu_and_city_county_elsewhere():
|
|
body = await _get("/v1/region/list")
|
|
assert body["result"]["success"] is True
|
|
assert len(body["regions"]) == 230
|
|
names = {r["name"] for r in body["regions"]}
|
|
assert "경기 수원시" in names and "경기 수원시 장안구" not in names
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_region_search_by_name():
|
|
body = await _get("/v1/region/list", q="마포")
|
|
assert [r["name"] for r in body["regions"]] == ["서울 마포구"]
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_nearest_from_mangwon_park_is_mapo():
|
|
body = await _get("/v1/region/nearest", lat=37.5555, lon=126.8950)
|
|
assert body["region"]["name"] == "서울 마포구"
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_nearest_rejects_point_outside_korea():
|
|
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
|
|
res = await client.get("/v1/region/nearest", params={"lat": 10, "lon": 127})
|
|
assert res.status_code == 422
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_enum_query_param_accepts_numeric_string():
|
|
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
|
|
res = await client.get("/v1/season/article/list", params={"category": "2"})
|
|
assert res.status_code == 200 and all(a["category"] == 2 for a in res.json()["articles"])
|