RICS / app /tests /test_phase1_factory_stub.py
StormShadow308's picture
feat: async pipeline, job queue, generation hardening, and docs
732b14f
Raw
History Blame Contribute Delete
873 Bytes
"""Phase-1 factory and config wiring stubs."""
from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
from app.vectorstore import factory as vs_factory
def test_vectorstore_factory_defaults_to_faiss(monkeypatch: pytest.MonkeyPatch) -> None:
vs_factory.reset_vectorstore()
monkeypatch.setenv("VECTORSTORE_BACKEND", "faiss")
from app.config import settings
monkeypatch.setattr(settings, "vectorstore_backend", "faiss", raising=False)
with patch("app.vectorstore.faiss_wrapper.FAISSVectorStore") as mock_cls:
mock_cls.return_value = MagicMock()
with patch("app.embeddings.factory.get_embedding_client", return_value=MagicMock()):
vs = vs_factory.get_vectorstore()
assert vs is not None
assert vs_factory.VECTORSTORE_BACKEND_LABEL == "faiss"
vs_factory.reset_vectorstore()