- 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.
54 lines
1.8 KiB
Python
54 lines
1.8 KiB
Python
import pytest
|
|
|
|
# We anticipate these imports will fail initially
|
|
try:
|
|
from ea_chatbot.history.models import Base, User, Conversation, Message, Plot
|
|
except ImportError:
|
|
Base = None
|
|
User = None
|
|
Conversation = None
|
|
Message = None
|
|
Plot = None
|
|
|
|
def test_models_exist():
|
|
assert User is not None, "User model not found"
|
|
assert Conversation is not None, "Conversation model not found"
|
|
assert Message is not None, "Message model not found"
|
|
assert Plot is not None, "Plot model not found"
|
|
assert Base is not None, "Base declarative class not found"
|
|
|
|
def test_user_model_columns():
|
|
if not User: pytest.fail("User model undefined")
|
|
# Basic check if columns exist (by inspecting __table__.columns)
|
|
columns = User.__table__.columns.keys()
|
|
assert "id" in columns
|
|
assert "username" in columns
|
|
assert "password_hash" in columns
|
|
assert "display_name" in columns
|
|
|
|
def test_conversation_model_columns():
|
|
if not Conversation: pytest.fail("Conversation model undefined")
|
|
columns = Conversation.__table__.columns.keys()
|
|
assert "id" in columns
|
|
assert "user_id" in columns
|
|
assert "data_state" in columns
|
|
assert "name" in columns
|
|
assert "summary" in columns
|
|
assert "created_at" in columns
|
|
|
|
def test_message_model_columns():
|
|
if not Message: pytest.fail("Message model undefined")
|
|
columns = Message.__table__.columns.keys()
|
|
assert "id" in columns
|
|
assert "role" in columns
|
|
assert "content" in columns
|
|
assert "conversation_id" in columns
|
|
assert "created_at" in columns
|
|
|
|
def test_plot_model_columns():
|
|
if not Plot: pytest.fail("Plot model undefined")
|
|
columns = Plot.__table__.columns.keys()
|
|
assert "id" in columns
|
|
assert "message_id" in columns
|
|
assert "image_data" in columns
|