Files
ea-chatbot-lg/backend/tests/test_llm_factory_callbacks.py
Yunxiao Xu 68c0985482 feat(auth): Complete OIDC security refactor and modernize test suite
- Refactored OIDC flow to implement PKCE, state/nonce validation, and BFF pattern.
- Centralized configuration in Settings class (DEV_MODE, FRONTEND_URL, OIDC_REDIRECT_URI).
- Updated auth routers to use conditional secure cookie flags based on DEV_MODE.
- Modernized and cleaned up test suite by removing legacy Streamlit tests.
- Fixed linting errors and unused imports across the backend.
2026-02-15 02:50:26 -08:00

19 lines
630 B
Python

from langchain_openai import ChatOpenAI
from ea_chatbot.config import LLMConfig
from ea_chatbot.utils.llm_factory import get_llm_model
from langchain_core.callbacks import BaseCallbackHandler
class MockHandler(BaseCallbackHandler):
pass
def test_get_llm_model_with_callbacks(monkeypatch):
"""Test that callbacks are passed to the model."""
monkeypatch.setenv("OPENAI_API_KEY", "dummy")
config = LLMConfig(provider="openai", model="gpt-4o")
handler = MockHandler()
model = get_llm_model(config, callbacks=[handler])
assert isinstance(model, ChatOpenAI)
assert handler in model.callbacks