Integration & Wiring: - useStore/useAppState wired into App.tsx (replaces 8 useState calls) - React Router wired at app root (URL-based navigation) - SparklineChart/MetricCard/BarChart integrated into Admin + Ethics pages - useNotifications.handleWSEvent wired into WebSocket handler - Notification center dropdown in header with unread badge - Locale selector added to Settings page (6 languages) - Dashboard data fetching with 10s polling into MetricCards - File drag-and-drop support on chat area Production Hardening: - PostgresStateBackend with connection pooling (psycopg2) - App lifespan wires backend from FUSIONAGI_DB_BACKEND env (memory|sqlite|postgres) - Redis cache wired from FUSIONAGI_REDIS_URL env at startup - Multi-process uvicorn config for horizontal scaling Testing: - Playwright visual regression tests (12 stories x 2 viewports) - k6 load test script with ramp/spike/ramp-down stages - 7 new Python tests (postgres fallback, app wiring) 575 Python tests + 45 frontend tests = 620 total, 0 ruff errors. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
"""Tests for app lifespan backend/cache wiring."""
|
|
|
|
|
|
from fusionagi.api.app import create_app
|
|
|
|
|
|
def test_create_app_default():
|
|
"""App should create successfully with default (memory) backend."""
|
|
app = create_app()
|
|
assert app is not None
|
|
assert app.title == "FusionAGI Dvādaśa API"
|
|
|
|
|
|
def test_create_app_with_sqlite_env(tmp_path, monkeypatch):
|
|
"""App should accept FUSIONAGI_DB_BACKEND=sqlite env."""
|
|
monkeypatch.setenv("FUSIONAGI_DB_BACKEND", "sqlite")
|
|
monkeypatch.setenv("FUSIONAGI_SQLITE_PATH", str(tmp_path / "test.db"))
|
|
app = create_app()
|
|
assert app is not None
|
|
|
|
|
|
def test_create_app_with_invalid_postgres(monkeypatch):
|
|
"""App should gracefully fall back when Postgres DSN is invalid."""
|
|
monkeypatch.setenv("FUSIONAGI_DB_BACKEND", "postgres")
|
|
monkeypatch.setenv("FUSIONAGI_POSTGRES_DSN", "postgresql://invalid:invalid@localhost:1/invalid")
|
|
app = create_app()
|
|
assert app is not None
|
|
|
|
|
|
def test_create_app_with_invalid_redis(monkeypatch):
|
|
"""App should gracefully fall back when Redis URL is invalid."""
|
|
monkeypatch.setenv("FUSIONAGI_REDIS_URL", "redis://localhost:1/0")
|
|
app = create_app()
|
|
assert app is not None
|