- git mv stock-lab/ → stock/ - docker-compose.yml: 서비스 키 + container_name + build.context + frontend.depends_on + agent-office STOCK_LAB_URL → STOCK_URL - agent-office/app: config.py, service_proxy.py, agents/stock.py, tests/ STOCK_LAB_URL → STOCK_URL - nginx/default.conf: proxy_pass http://stock-lab → http://stock (3 lines) - CLAUDE.md / README.md / STATUS.md / scripts/ 문구 갱신 - stock/ 내부 자기 참조 갱신 lab 네이밍 정책 (feedback_lab_naming.md) graduation. API URL / Python import / DB 파일명 변경 없음.
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
import sqlite3
|
|
from app.screener.schema import ensure_screener_schema
|
|
|
|
|
|
def test_creates_all_tables(tmp_path):
|
|
db_path = tmp_path / "test.db"
|
|
conn = sqlite3.connect(db_path)
|
|
ensure_screener_schema(conn)
|
|
|
|
tables = {r[0] for r in conn.execute(
|
|
"SELECT name FROM sqlite_master WHERE type='table'"
|
|
).fetchall()}
|
|
|
|
expected = {
|
|
"krx_master", "krx_daily_prices", "krx_flow",
|
|
"screener_settings", "screener_runs", "screener_results",
|
|
}
|
|
assert expected.issubset(tables)
|
|
|
|
|
|
def test_settings_seeded_with_singleton_row(tmp_path):
|
|
db_path = tmp_path / "test.db"
|
|
conn = sqlite3.connect(db_path)
|
|
ensure_screener_schema(conn)
|
|
|
|
rows = conn.execute("SELECT id FROM screener_settings").fetchall()
|
|
assert rows == [(1,)]
|
|
|
|
|
|
def test_idempotent(tmp_path):
|
|
db_path = tmp_path / "test.db"
|
|
conn = sqlite3.connect(db_path)
|
|
ensure_screener_schema(conn)
|
|
ensure_screener_schema(conn) # 두 번 호출해도 에러 없어야 함
|
|
|
|
rows = conn.execute("SELECT count(*) FROM screener_settings").fetchall()
|
|
assert rows == [(1,)]
|