import pytest from unittest.mock import Mock, AsyncMock, patch from fastapi.testclient import TestClient from dotigent.backend.app.main import app @pytest.fixture def client_with_fake_runtime(): fake_runtime = Mock() # If your routes call await runtime methods, use AsyncMock for those fake_runtime.run_agent = AsyncMock(return_value={"ok": True}) # Patch where the runtime is looked up in your code path. # If handlers access app.state.runtime: with patch.object(app.state, "runtime", fake_runtime, create=True): with TestClient(app) as client: yield client