Add the core labeling data model (label sets, ad-hoc Main->Sub class hierarchy, frames, bounding-box labels, per-frame/per-set label status) behind a FastAPI app, with SQLite as the default swappable DATABASE_URL. Multi-user support is attribution-only for now (get-or-create by username, no login flow yet). Dataset versioning/promotion is intentionally deferred - it needs its own design pass around snapshot semantics. Each test gets a fully isolated app+DB via create_app(database_url=...) rather than relying on process-global state. 13/13 tests pass; also verified live end-to-end against a running uvicorn instance. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
13 lines
314 B
Python
13 lines
314 B
Python
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from spelunkai_labeling_backend.main import create_app
|
|
|
|
|
|
@pytest.fixture()
|
|
def client(tmp_path):
|
|
db_path = tmp_path / "test.db"
|
|
app = create_app(database_url=f"sqlite:///{db_path}")
|
|
with TestClient(app) as test_client:
|
|
yield test_client
|