c29186a227
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>
31 lines
815 B
Python
31 lines
815 B
Python
"""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)
|