- announcements.district + idx_ann_district 인덱스 - user_profile: preferred_districts(JSON obj), min_match_score(int 70), notify_enabled(bool) - match_results: notified_at(TEXT) - _profile_row_to_dict: notify_enabled bool화, preferred_districts dict 역직렬화 - PROFILE_COLUMNS 확장 (3 신규 필드) - upsert_profile: list|dict 모두 JSON 직렬화 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
def test_user_profile_has_new_columns():
|
|
from app.db import _conn
|
|
with _conn() as conn:
|
|
cols = {row["name"] for row in conn.execute("PRAGMA table_info(user_profile)")}
|
|
assert "preferred_districts" in cols
|
|
assert "min_match_score" in cols
|
|
assert "notify_enabled" in cols
|
|
|
|
|
|
def test_announcements_has_district():
|
|
from app.db import _conn
|
|
with _conn() as conn:
|
|
cols = {row["name"] for row in conn.execute("PRAGMA table_info(announcements)")}
|
|
assert "district" in cols
|
|
|
|
|
|
def test_match_results_has_notified_at():
|
|
from app.db import _conn
|
|
with _conn() as conn:
|
|
cols = {row["name"] for row in conn.execute("PRAGMA table_info(match_results)")}
|
|
assert "notified_at" in cols
|
|
|
|
|
|
def test_district_index_exists():
|
|
from app.db import _conn
|
|
with _conn() as conn:
|
|
idx = {row["name"] for row in conn.execute(
|
|
"SELECT name FROM sqlite_master WHERE type='index'"
|
|
)}
|
|
assert "idx_ann_district" in idx
|
|
|
|
|
|
def test_profile_defaults():
|
|
from app.db import upsert_profile, get_profile
|
|
upsert_profile({"name": "테스트"})
|
|
profile = get_profile()
|
|
assert profile["preferred_districts"] == {}
|
|
assert profile["min_match_score"] == 70
|
|
assert profile["notify_enabled"] is True
|