This commit is contained in:
Petitminion 2025-03-25 17:45:39 +01:00
parent 612ab4888e
commit da4edbe375
1 changed files with 8 additions and 5 deletions

View File

@ -6,15 +6,18 @@ from funkwhale_api.contrib.archivedl import tasks
def test_check_existing_download_task(factories, caplog, mocker):
logger = logging.getLogger("funkwhale_api.contrib.archivedl")
caplog.set_level(logging.INFO)
logger.addHandler(caplog.handler)
upload = factories["music.Upload"](
third_party_provider="archive-dl", import_status="pending"
)
mocker.patch("funkwhale_api.contrib.archivedl.tasks.fetch_json", return_value={})
with pytest.raises(
tasks.TooManyQueriesError,
match=r".*Upload for this track already exist or is pending. Stopping task.*",
):
tasks.archive_download(track_id=upload.track.id, conf={})
tasks.archive_download(track_id=upload.track.id, conf={})
assert (
"Upload for this track already exist or is pending. Stopping task"
in caplog.text
)
def test_check_last_third_party_queries(factories, caplog, mocker):