Foundation (phase 01, verified): - FastAPI app: /api/health, /api/suggestions, /api/chat (placeholder), static frontend served locally (no CDN) - Postgres 17 + pgvector via db/Containerfile + compose.yaml (podman compose up -d db), Alembic initial migration (documents, chunks with vector(768), query_log) - LLM client targeting https://aipi.reeseapps.com/v1 (turbo/embed); scripts/llm_probe.py verified models + 768-dim embeddings live - Conditional debugpy: imported only when DEBUGPY=1 (attach on demand, :5678); logging config for clean single-line logs - Frontend shell: mobile-first chat + Sources pages, tokens, a11y baselines - Tests: 24 unit+integration (99% coverage on app/), ruff + pyright clean, Playwright smoke E2E (3 tests) against a deterministic mock LLM - Planning: .agent/PLAN.md (architecture + LOCKED decisions), AGENTS.md, 6 user stories, 7 phase files (one story / one phase / one Playwright suite each)
22 lines
711 B
Python
22 lines
711 B
Python
"""Unit tests: app factory edge cases (no live DB needed)."""
|
|
from __future__ import annotations
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
import app.main as main_mod
|
|
|
|
|
|
def test_create_app_warns_and_serves_api_only_without_static_dir(
|
|
monkeypatch, tmp_path
|
|
) -> None:
|
|
"""If the frontend directory is missing, the API still boots (PLAN §7)."""
|
|
monkeypatch.setattr(
|
|
main_mod.settings, "static_dir", str(tmp_path / "definitely-missing")
|
|
)
|
|
app2 = main_mod.create_app()
|
|
client = TestClient(app2)
|
|
# /api still works…
|
|
assert client.get("/api/health").status_code == 200
|
|
# …but the static mount is absent (no index page).
|
|
assert client.get("/").status_code == 404
|