Core modules: - Laws: CRUD, search, AI-powered QA - Analysis: legal research and case management - Contracts: lifecycle management with templates - Signatures: electronic signature workflow Infrastructure: - FastAPI + SQLite + async SQLAlchemy - Docker deployment support - 54 unit tests passing Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
61 lines
2.2 KiB
Python
61 lines
2.2 KiB
Python
"""Unit tests for core configuration."""
|
|
import pytest
|
|
from app.core.config import Settings
|
|
|
|
|
|
class TestSettings:
|
|
"""Test cases for Settings configuration."""
|
|
|
|
def test_default_settings(self):
|
|
"""Test default configuration values."""
|
|
settings = Settings()
|
|
|
|
assert settings.APP_NAME == "AI Legal Assistant"
|
|
assert settings.APP_VERSION == "1.0.0"
|
|
assert settings.DEBUG is False
|
|
assert settings.DATABASE_URL == "sqlite+aiosqlite:///./data/legal_assistant.db"
|
|
|
|
def test_custom_settings_from_env(self, monkeypatch):
|
|
"""Test configuration from environment variables."""
|
|
monkeypatch.setenv("DEBUG", "true")
|
|
monkeypatch.setenv("DATABASE_URL", "sqlite+aiosqlite:///./test.db")
|
|
monkeypatch.setenv("LLM_API_KEY", "test-key")
|
|
|
|
settings = Settings()
|
|
|
|
assert settings.DEBUG is True
|
|
assert settings.DATABASE_URL == "sqlite+aiosqlite:///./test.db"
|
|
assert settings.LLM_API_KEY == "test-key"
|
|
|
|
def test_llm_settings(self, monkeypatch):
|
|
"""Test LLM configuration."""
|
|
monkeypatch.setenv("LLM_API_BASE", "https://api.example.com/v1")
|
|
monkeypatch.setenv("LLM_MODEL", "gpt-4")
|
|
|
|
settings = Settings()
|
|
|
|
assert settings.LLM_API_BASE == "https://api.example.com/v1"
|
|
assert settings.LLM_MODEL == "gpt-4"
|
|
|
|
def test_embedding_settings(self, monkeypatch):
|
|
"""Test embedding configuration."""
|
|
monkeypatch.setenv("EMBEDDING_MODEL", "text-embedding-3-small")
|
|
monkeypatch.setenv("EMBEDDING_DIMENSION", "1536")
|
|
|
|
settings = Settings()
|
|
|
|
assert settings.EMBEDDING_MODEL == "text-embedding-3-small"
|
|
assert settings.EMBEDDING_DIMENSION == 1536
|
|
|
|
def test_jwt_settings(self, monkeypatch):
|
|
"""Test JWT configuration."""
|
|
monkeypatch.setenv("JWT_SECRET_KEY", "test-secret-key")
|
|
monkeypatch.setenv("JWT_ALGORITHM", "HS256")
|
|
monkeypatch.setenv("JWT_ACCESS_TOKEN_EXPIRE_MINUTES", "60")
|
|
|
|
settings = Settings()
|
|
|
|
assert settings.JWT_SECRET_KEY == "test-secret-key"
|
|
assert settings.JWT_ALGORITHM == "HS256"
|
|
assert settings.JWT_ACCESS_TOKEN_EXPIRE_MINUTES == 60
|