- 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.
19 lines
630 B
Python
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
|