Files
evanescere/tests/test_thumbnail.py
2026-05-31 23:30:35 -07:00

23 lines
738 B
Python

from pathlib import Path
from unittest.mock import patch
from evanescere.services.thumbnail import select_character_overlay
def test_select_character_overlay_returns_none_for_empty_directory(tmp_path: Path):
assert select_character_overlay(str(tmp_path)) is None
def test_select_character_overlay_filters_png_files(tmp_path: Path):
first = tmp_path / "first.PNG"
second = tmp_path / "second.png"
first.write_bytes(b"")
second.write_bytes(b"")
(tmp_path / "notes.txt").write_text("ignore me")
with patch("evanescere.services.thumbnail.random.choice", return_value=second) as choice:
assert select_character_overlay(str(tmp_path)) == second
assert choice.call_args.args[0] == [first, second]