From bf6d8b22873e63e211b2fd0f5b5243fe5532ec02 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Fri, 28 Jul 2023 12:58:26 -0700 Subject: [PATCH] more test coverage --- tests/e2e/youtube/test_video.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/e2e/youtube/test_video.py b/tests/e2e/youtube/test_video.py index 173eaa51..00f05144 100644 --- a/tests/e2e/youtube/test_video.py +++ b/tests/e2e/youtube/test_video.py @@ -159,17 +159,18 @@ class TestYoutubeVideo: preset_dict=single_video_preset_dict, ) - def delete_entry_thumbnail(entry: Entry) -> None: - if ytdlp_thumb_path := entry.try_get_ytdlp_download_thumbnail_path(): - FileHandler.delete(ytdlp_thumb_path) + def delete_entry_thumb(entry: Entry) -> None: 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( + with patch.object(YTDLP, "_EXTRACT_ENTRY_NUM_RETRIES", 1), patch.object( + Entry, "try_get_ytdlp_download_thumbnail_path" + ) as mock_ytdlp_path, patch( "ytdl_sub.downloaders.url.downloader.try_convert_download_thumbnail", - side_effect=delete_entry_thumbnail, + side_effect=delete_entry_thumb, ): + mock_ytdlp_path.return_value = None transaction_log = single_video_subscription.download(dry_run=False) assert_transaction_log_matches(