diff --git a/tests/e2e/youtube/test_video.py b/tests/e2e/youtube/test_video.py index 27c22d77..173eaa51 100644 --- a/tests/e2e/youtube/test_video.py +++ b/tests/e2e/youtube/test_video.py @@ -10,6 +10,7 @@ from ytdl_sub.downloaders.ytdlp import YTDLP from ytdl_sub.entries.entry import Entry from ytdl_sub.subscriptions.subscription import Subscription from ytdl_sub.utils.file_handler import FileHandler +from ytdl_sub.utils.thumbnail import try_convert_download_thumbnail @pytest.fixture @@ -158,17 +159,17 @@ class TestYoutubeVideo: preset_dict=single_video_preset_dict, ) - def delete_entry_thumb(entry: Entry) -> None: + def delete_entry_thumbnail(entry: Entry) -> None: + if ytdlp_thumb_path := entry.try_get_ytdlp_download_thumbnail_path(): + FileHandler.delete(ytdlp_thumb_path) FileHandler.delete(entry.get_download_thumbnail_path()) + try_convert_download_thumbnail(entry=entry) # Pretend the thumbnail did not download via returning nothing for its downloaded path - with patch.object(YTDLP, "_EXTRACT_ENTRY_NUM_RETRIES", 1), patch.object( - Entry, "get_ytdlp_download_thumbnail_path" - ) as mock_ytdlp_path, patch( + with patch.object(YTDLP, "_EXTRACT_ENTRY_NUM_RETRIES", 1), patch( "ytdl_sub.downloaders.url.downloader.try_convert_download_thumbnail", - side_effect=delete_entry_thumb, + side_effect=delete_entry_thumbnail, ): - mock_ytdlp_path.return_value = None transaction_log = single_video_subscription.download(dry_run=False) assert_transaction_log_matches(