fixes
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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]
|
||||
|
||||
Reference in New Issue
Block a user