test: add characterization tests for core modules

33 tests covering env/io helpers, config parsers, pipeline meta I/O,
worker inbox logic, and FastAPI smoke routes. No gmic/rembg subprocesses.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Frank Schwenk
2026-07-18 17:12:09 +02:00
parent 1cf4ea0f07
commit c29186a227
8 changed files with 306 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
"""Tests for config helpers."""
from __future__ import annotations
from app import config
from app.config import _float_env, _int_env
def test_int_env_valid(monkeypatch) -> None:
monkeypatch.setenv("TEST_INT", "42")
assert _int_env("TEST_INT", 0) == 42
def test_int_env_invalid_falls_back(monkeypatch) -> None:
monkeypatch.setenv("TEST_INT", "nope")
assert _int_env("TEST_INT", 7) == 7
def test_float_env_valid(monkeypatch) -> None:
monkeypatch.setenv("TEST_FLOAT", "2.5")
assert _float_env("TEST_FLOAT", 0.0) == 2.5
def test_supported_extensions() -> None:
assert ".jpg" in config.SUPPORTED_EXTENSIONS
assert ".jpeg" in config.SUPPORTED_EXTENSIONS
def test_opacity_choices_percentages() -> None:
assert all(choice.endswith("%") for choice in config.OPACITY_CHOICES)