- Add pytest config in backend/pyproject.toml with asyncio mode and coverage - Add backend/requirements-test.txt with pytest, pytest-cov, pytest-asyncio, aiosqlite - Write 86 backend unit tests covering auth (JWT tokens), schemas (Pydantic models), config (Settings env overrides), log_parser (log parsing, IP resolution, geo data), models (SQLAlchemy table definitions + column defaults), and theme export - Add Vitest config for Angular frontend (vitest.config.ts, src/test-setup.ts) - Add .gitlab-ci.yml with stages: backend-test, frontend-test, backend-lint, docker-build, and quality-gate - CI enforces 10% minimum coverage threshold for backend
23 lines
782 B
Python
23 lines
782 B
Python
"""Tests for theme_export — theme.json generation from station config."""
|
|
|
|
import os
|
|
import json
|
|
import pytest
|
|
from unittest.mock import patch, AsyncMock, MagicMock
|
|
|
|
from app.config import Settings
|
|
|
|
|
|
class TestThemeExport:
|
|
"""Tests for theme.json export logic."""
|
|
|
|
def test_settings_theme_json_path_default(self):
|
|
with patch.dict("os.environ", {"KMTN_THEME_JSON_PATH": "/app/theme.json"}, clear=False):
|
|
settings = Settings()
|
|
assert settings.THEME_JSON_PATH == "/app/theme.json"
|
|
|
|
def test_settings_website_url_default(self):
|
|
with patch.dict("os.environ", {"KMTN_WEBSITE_URL": "https://kmountainflower.org"}, clear=False):
|
|
settings = Settings()
|
|
assert settings.WEBSITE_URL == "https://kmountainflower.org"
|