test: add unit test suite for config, health checks, and lifespan wiring

This commit is contained in:
2026-08-16 11:54:14 +03:30
parent 3c660de093
commit d71dd1bd0c
19 changed files with 118 additions and 0 deletions

27
tests/unit/test_config.py Normal file
View File

@@ -0,0 +1,27 @@
from pathlib import Path
import pytest
from src.config import Settings
pytestmark = pytest.mark.unit
def test_settings_loads_defaults_without_env_file() -> None:
settings = Settings(_env_file=None)
assert settings.postgres.port == 5433
assert settings.minio.bucket == "chatbot-source-files"
assert settings.ingestion.max_concurrency == 4
assert settings.qdrant.url == "http://127.0.0.1:6343"
def test_settings_parses_env_example() -> None:
env_example = Path(__file__).parent.parent.parent / ".env.example"
settings = Settings(_env_file=env_example)
assert settings.postgres.host == "127.0.0.1"
assert settings.minio.endpoint == "127.0.0.1:9100"
assert settings.ingestion.embed_batch_size == 128
assert settings.qdrant.api_key is None