Files
FusionAGI/tests/test_app_wiring.py

35 lines
1.2 KiB
Python
Raw Normal View History

"""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