Aniworld/tests/unit/test_anime_service.py

28 lines
736 B
Python

import asyncio
import pytest
from src.server.services.anime_service import AnimeService, AnimeServiceError
@pytest.mark.asyncio
async def test_list_missing_empty(tmp_path):
svc = AnimeService(directory=str(tmp_path))
# SeriesApp may return empty list depending on filesystem; ensure it returns a list
result = await svc.list_missing()
assert isinstance(result, list)
@pytest.mark.asyncio
async def test_search_empty_query(tmp_path):
svc = AnimeService(directory=str(tmp_path))
res = await svc.search("")
assert res == []
@pytest.mark.asyncio
async def test_rescan_and_cache_clear(tmp_path):
svc = AnimeService(directory=str(tmp_path))
# calling rescan should not raise
await svc.rescan()