integration tests
This commit is contained in:
parent
252aa36f1a
commit
6430e85684
14 changed files with 456 additions and 39 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
REGENERATE_FIXTURES: bool = False
|
||||
REGENERATE_FIXTURES: bool = True
|
||||
|
||||
RESOURCE_PATH: Path = Path("tests") / "resources"
|
||||
_FILE_FIXTURE_PATH: Path = RESOURCE_PATH / "file_fixtures"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
".ytdl-sub-subscription_test-download-archive.json": "3d12578ca04adf67117b8aa2b32634f9",
|
||||
"subscription_test/[2020] Mock Entry 20-1/02 - Mock Entry 20-1.mp3": "ba28f3597c223ca59c781c862de65ecc",
|
||||
"subscription_test/[2020] Mock Entry 20-1/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-2/03 - Mock Entry 20-2.mp3": "dbfc73ad4fab626793f8430ba60dfe32",
|
||||
"subscription_test/[2020] Mock Entry 20-2/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-3/04 - Mock Entry 20-3.mp3": "2efa8690b7462c1ed075a7804df36247",
|
||||
"subscription_test/[2020] Mock Entry 20-3/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2021] Mock Entry 21-1/01 - Mock Entry 21-1.mp3": "d27a7a267742f5d7a155995484795f9c",
|
||||
"subscription_test/[2021] Mock Entry 21-1/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7"
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
".ytdl-sub-subscription_test-download-archive.json": "9f6f4458d42da4561db236473896fe71",
|
||||
"subscription_test/[2020] Mock Entry 20-1/01 - Mock Entry 20-1.mp3": "97320d70b1ccf04d4900b95b3c3645bc",
|
||||
"subscription_test/[2020] Mock Entry 20-1/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-2/01 - Mock Entry 20-2.mp3": "b3ceb9fc194b524c77287e248d5860aa",
|
||||
"subscription_test/[2020] Mock Entry 20-2/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-3/01 - Mock Entry 20-3.mp3": "55202bc60302d8475a3eaebc0902a253",
|
||||
"subscription_test/[2020] Mock Entry 20-3/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2021] Mock Entry 21-1/01 - Mock Entry 21-1.mp3": "2ad0d8ee1e28a2ecc726197cda67248d",
|
||||
"subscription_test/[2021] Mock Entry 21-1/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7"
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
".ytdl-sub-subscription_test-download-archive.json": "e2bac02784de402eeed809b4766dafc4",
|
||||
"subscription_test/[2020] Mock Entry 20-1/02 - Mock Entry 20-1.mp3": "ba28f3597c223ca59c781c862de65ecc",
|
||||
"subscription_test/[2020] Mock Entry 20-1/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-2/03 - Mock Entry 20-2.mp3": "dbfc73ad4fab626793f8430ba60dfe32",
|
||||
"subscription_test/[2020] Mock Entry 20-2/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-3/04 - Mock Entry 20-3.mp3": "2efa8690b7462c1ed075a7804df36247",
|
||||
"subscription_test/[2020] Mock Entry 20-3/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-4/01 - Mock Entry 20-4.mp3": "5ceaa156a59d7f80dd74d9ce80cf8e5c",
|
||||
"subscription_test/[2020] Mock Entry 20-4/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-5/01 - Mock Entry 20-5.mp3": "e651c65df918ab082d7051cd9b743972",
|
||||
"subscription_test/[2020] Mock Entry 20-5/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-6/01 - Mock Entry 20-6.mp3": "c045e7ca79847848b4ccd905ae65c2f9",
|
||||
"subscription_test/[2020] Mock Entry 20-6/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-7/01 - Mock Entry 20-7.mp3": "974fe1dc4a18a67f4b0e8c7c123397e3",
|
||||
"subscription_test/[2020] Mock Entry 20-7/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2021] Mock Entry 21-1/01 - Mock Entry 21-1.mp3": "d27a7a267742f5d7a155995484795f9c",
|
||||
"subscription_test/[2021] Mock Entry 21-1/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7"
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
".ytdl-sub-subscription_test-download-archive.json": "9f6f4458d42da4561db236473896fe71",
|
||||
"subscription_test/[2020] Mock Entry 20-1/01 - Mock Entry 20-1.mp3": "97320d70b1ccf04d4900b95b3c3645bc",
|
||||
"subscription_test/[2020] Mock Entry 20-1/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-2/01 - Mock Entry 20-2.mp3": "b3ceb9fc194b524c77287e248d5860aa",
|
||||
"subscription_test/[2020] Mock Entry 20-2/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-3/01 - Mock Entry 20-3.mp3": "55202bc60302d8475a3eaebc0902a253",
|
||||
"subscription_test/[2020] Mock Entry 20-3/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2021] Mock Entry 21-1/01 - Mock Entry 21-1.mp3": "2ad0d8ee1e28a2ecc726197cda67248d",
|
||||
"subscription_test/[2021] Mock Entry 21-1/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7"
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
".ytdl-sub-subscription_test-download-archive.json": "3d12578ca04adf67117b8aa2b32634f9",
|
||||
"subscription_test/[2020] Mock Entry 20-1/02 - Mock Entry 20-1.mp3": "ba28f3597c223ca59c781c862de65ecc",
|
||||
"subscription_test/[2020] Mock Entry 20-1/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-2/03 - Mock Entry 20-2.mp3": "dbfc73ad4fab626793f8430ba60dfe32",
|
||||
"subscription_test/[2020] Mock Entry 20-2/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2020] Mock Entry 20-3/04 - Mock Entry 20-3.mp3": "2efa8690b7462c1ed075a7804df36247",
|
||||
"subscription_test/[2020] Mock Entry 20-3/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7",
|
||||
"subscription_test/[2021] Mock Entry 21-1/01 - Mock Entry 21-1.mp3": "d27a7a267742f5d7a155995484795f9c",
|
||||
"subscription_test/[2021] Mock Entry 21-1/folder.jpg": "e80c508c4818454300133fe1dc1a9cd7"
|
||||
}
|
||||
BIN
tests/resources/file_fixtures/sample_audio.mp3
Normal file
BIN
tests/resources/file_fixtures/sample_audio.mp3
Normal file
Binary file not shown.
|
|
@ -0,0 +1,60 @@
|
|||
Files created:
|
||||
----------------------------------------
|
||||
{output_directory}
|
||||
.ytdl-sub-subscription_test-download-archive.json
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-1
|
||||
02 - Mock Entry 20-1.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-1
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-1
|
||||
track: 2
|
||||
tracktotal: 4
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-2
|
||||
03 - Mock Entry 20-2.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-2
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-2
|
||||
track: 3
|
||||
tracktotal: 4
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-3
|
||||
04 - Mock Entry 20-3.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-3
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-3
|
||||
track: 4
|
||||
tracktotal: 4
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2021] Mock Entry 21-1
|
||||
01 - Mock Entry 21-1.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 21-1
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 21-1
|
||||
track: 1
|
||||
tracktotal: 4
|
||||
year: 2021
|
||||
folder.jpg
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
Files created:
|
||||
----------------------------------------
|
||||
{output_directory}
|
||||
.ytdl-sub-subscription_test-download-archive.json
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-1
|
||||
01 - Mock Entry 20-1.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-1
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-1
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-2
|
||||
01 - Mock Entry 20-2.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-2
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-2
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-3
|
||||
01 - Mock Entry 20-3.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-3
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-3
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2021] Mock Entry 21-1
|
||||
01 - Mock Entry 21-1.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 21-1
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 21-1
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2021
|
||||
folder.jpg
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
Files created:
|
||||
----------------------------------------
|
||||
{output_directory}
|
||||
.ytdl-sub-subscription_test-download-archive.json
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-1
|
||||
02 - Mock Entry 20-1.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-1
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-1
|
||||
track: 2
|
||||
tracktotal: 4
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-2
|
||||
03 - Mock Entry 20-2.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-2
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-2
|
||||
track: 3
|
||||
tracktotal: 4
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-3
|
||||
04 - Mock Entry 20-3.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-3
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-3
|
||||
track: 4
|
||||
tracktotal: 4
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-4
|
||||
01 - Mock Entry 20-4.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-4
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-4
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-5
|
||||
01 - Mock Entry 20-5.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-5
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-5
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-6
|
||||
01 - Mock Entry 20-6.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-6
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-6
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-7
|
||||
01 - Mock Entry 20-7.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-7
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-7
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2021] Mock Entry 21-1
|
||||
01 - Mock Entry 21-1.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 21-1
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 21-1
|
||||
track: 1
|
||||
tracktotal: 4
|
||||
year: 2021
|
||||
folder.jpg
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
Files created:
|
||||
----------------------------------------
|
||||
{output_directory}
|
||||
.ytdl-sub-subscription_test-download-archive.json
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-1
|
||||
01 - Mock Entry 20-1.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-1
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-1
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-2
|
||||
01 - Mock Entry 20-2.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-2
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-2
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-3
|
||||
01 - Mock Entry 20-3.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-3
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-3
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2021] Mock Entry 21-1
|
||||
01 - Mock Entry 21-1.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 21-1
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 21-1
|
||||
track: 1
|
||||
tracktotal: 1
|
||||
year: 2021
|
||||
folder.jpg
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
Files created:
|
||||
----------------------------------------
|
||||
{output_directory}
|
||||
.ytdl-sub-subscription_test-download-archive.json
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-1
|
||||
02 - Mock Entry 20-1.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-1
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-1
|
||||
track: 2
|
||||
tracktotal: 4
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-2
|
||||
03 - Mock Entry 20-2.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-2
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-2
|
||||
track: 3
|
||||
tracktotal: 4
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2020] Mock Entry 20-3
|
||||
04 - Mock Entry 20-3.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 20-3
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 20-3
|
||||
track: 4
|
||||
tracktotal: 4
|
||||
year: 2020
|
||||
folder.jpg
|
||||
{output_directory}/subscription_test/[2021] Mock Entry 21-1
|
||||
01 - Mock Entry 21-1.mp3
|
||||
Music Tags:
|
||||
album: Mock Entry 21-1
|
||||
albumartist: subscription_test
|
||||
albumartists: subscription_test
|
||||
artist: subscription_test
|
||||
artists: subscription_test
|
||||
genre: Unset
|
||||
title: Mock Entry 21-1
|
||||
track: 1
|
||||
tracktotal: 4
|
||||
year: 2021
|
||||
folder.jpg
|
||||
|
|
@ -57,6 +57,7 @@ def mock_entry_dict_factory(mock_downloaded_file_path) -> Callable:
|
|||
playlist_count: int = 1,
|
||||
is_youtube_channel: bool = False,
|
||||
mock_download_to_working_dir: bool = True,
|
||||
is_extracted_audio: bool = False,
|
||||
) -> Dict:
|
||||
entry_dict = {
|
||||
UID: uid,
|
||||
|
|
@ -86,10 +87,16 @@ def mock_entry_dict_factory(mock_downloaded_file_path) -> Callable:
|
|||
|
||||
# Create mock video file
|
||||
if mock_download_to_working_dir:
|
||||
copy_file_fixture(
|
||||
fixture_name="sample_vid.mp4",
|
||||
output_file_path=mock_downloaded_file_path(f"{uid}.mp4"),
|
||||
)
|
||||
if is_extracted_audio:
|
||||
copy_file_fixture(
|
||||
fixture_name="sample_audio.mp3",
|
||||
output_file_path=mock_downloaded_file_path(f"{uid}.mp3"),
|
||||
)
|
||||
else:
|
||||
copy_file_fixture(
|
||||
fixture_name="sample_vid.mp4",
|
||||
output_file_path=mock_downloaded_file_path(f"{uid}.mp4"),
|
||||
)
|
||||
copy_file_fixture(
|
||||
fixture_name="thumb.jpg", output_file_path=mock_downloaded_file_path(f"{uid}.jpg")
|
||||
)
|
||||
|
|
@ -106,10 +113,14 @@ def mock_download_collection_thumbnail(mock_downloaded_file_path):
|
|||
_ = thumbnail_url
|
||||
output_name = os.path.basename(output_thumbnail_path)
|
||||
if "poster" in output_name or "show" in output_name:
|
||||
copy_file_fixture(fixture_name="poster.jpg", output_file_path=output_thumbnail_path)
|
||||
copy_file_fixture(
|
||||
fixture_name="poster.jpg", output_file_path=Path(output_thumbnail_path)
|
||||
)
|
||||
return True
|
||||
elif "fanart" in output_name:
|
||||
copy_file_fixture(fixture_name="fanart.jpeg", output_file_path=output_thumbnail_path)
|
||||
copy_file_fixture(
|
||||
fixture_name="fanart.jpeg", output_file_path=Path(output_thumbnail_path)
|
||||
)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
@ -125,9 +136,14 @@ def mock_download_collection_entries(
|
|||
mock_download_collection_thumbnail, mock_entry_dict_factory: Callable, working_directory: str
|
||||
):
|
||||
@contextlib.contextmanager
|
||||
def _mock_download_collection_entries_factory(is_youtube_channel: bool, num_urls: int = 1):
|
||||
def _mock_download_collection_entries_factory(
|
||||
is_youtube_channel: bool, num_urls: int = 1, is_extracted_audio: bool = False
|
||||
):
|
||||
def _write_entries_to_working_dir(*args, **kwargs) -> List[Dict]:
|
||||
if num_urls == 1 or ("2" in kwargs["url"] and num_urls > 1):
|
||||
# Second TV URL or second soundcloud URL, which downloads first
|
||||
is_second_url = "2" in kwargs["url"] or kwargs["url"].endswith("/albums")
|
||||
|
||||
if num_urls == 1 or (is_second_url and num_urls > 1):
|
||||
return [
|
||||
mock_entry_dict_factory(
|
||||
uid="21-1",
|
||||
|
|
@ -135,6 +151,7 @@ def mock_download_collection_entries(
|
|||
playlist_index=1,
|
||||
playlist_count=4,
|
||||
is_youtube_channel=is_youtube_channel,
|
||||
is_extracted_audio=is_extracted_audio,
|
||||
), # 1
|
||||
mock_entry_dict_factory(
|
||||
uid="20-1",
|
||||
|
|
@ -142,6 +159,7 @@ def mock_download_collection_entries(
|
|||
playlist_index=2,
|
||||
playlist_count=4,
|
||||
is_youtube_channel=is_youtube_channel,
|
||||
is_extracted_audio=is_extracted_audio,
|
||||
), # 2 98
|
||||
mock_entry_dict_factory(
|
||||
uid="20-2",
|
||||
|
|
@ -149,6 +167,7 @@ def mock_download_collection_entries(
|
|||
playlist_index=3,
|
||||
playlist_count=4,
|
||||
is_youtube_channel=is_youtube_channel,
|
||||
is_extracted_audio=is_extracted_audio,
|
||||
), # 1 99
|
||||
mock_entry_dict_factory(
|
||||
uid="20-3",
|
||||
|
|
@ -156,6 +175,7 @@ def mock_download_collection_entries(
|
|||
playlist_index=4,
|
||||
playlist_count=4,
|
||||
is_youtube_channel=is_youtube_channel,
|
||||
is_extracted_audio=is_extracted_audio,
|
||||
),
|
||||
]
|
||||
return [
|
||||
|
|
@ -167,6 +187,7 @@ def mock_download_collection_entries(
|
|||
playlist_count=5,
|
||||
is_youtube_channel=is_youtube_channel,
|
||||
mock_download_to_working_dir=False,
|
||||
is_extracted_audio=is_extracted_audio,
|
||||
),
|
||||
mock_entry_dict_factory(
|
||||
uid="20-4",
|
||||
|
|
@ -174,6 +195,7 @@ def mock_download_collection_entries(
|
|||
playlist_index=2,
|
||||
playlist_count=5,
|
||||
is_youtube_channel=is_youtube_channel,
|
||||
is_extracted_audio=is_extracted_audio,
|
||||
),
|
||||
mock_entry_dict_factory(
|
||||
uid="20-5",
|
||||
|
|
@ -181,6 +203,7 @@ def mock_download_collection_entries(
|
|||
playlist_index=3,
|
||||
playlist_count=5,
|
||||
is_youtube_channel=is_youtube_channel,
|
||||
is_extracted_audio=is_extracted_audio,
|
||||
),
|
||||
mock_entry_dict_factory(
|
||||
uid="20-6",
|
||||
|
|
@ -188,6 +211,7 @@ def mock_download_collection_entries(
|
|||
playlist_index=4,
|
||||
playlist_count=5,
|
||||
is_youtube_channel=is_youtube_channel,
|
||||
is_extracted_audio=is_extracted_audio,
|
||||
),
|
||||
mock_entry_dict_factory(
|
||||
uid="20-7",
|
||||
|
|
@ -195,6 +219,7 @@ def mock_download_collection_entries(
|
|||
playlist_index=5,
|
||||
playlist_count=5,
|
||||
is_youtube_channel=is_youtube_channel,
|
||||
is_extracted_audio=is_extracted_audio,
|
||||
),
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -395,7 +395,9 @@ class TestPrebuiltMusicPresets:
|
|||
if music_preset == "SoundCloud Discography":
|
||||
num_urls = 2 # simulate /albums and /tracks
|
||||
|
||||
with mock_download_collection_entries(is_youtube_channel=False, num_urls=num_urls):
|
||||
with mock_download_collection_entries(
|
||||
is_youtube_channel=False, num_urls=num_urls, is_extracted_audio=True
|
||||
):
|
||||
transaction_log = subscription.download(dry_run=False)
|
||||
|
||||
assert_transaction_log_matches(
|
||||
|
|
@ -408,32 +410,3 @@ class TestPrebuiltMusicPresets:
|
|||
dry_run=False,
|
||||
expected_download_summary_file_name=f"{expected_summary_name}.json",
|
||||
)
|
||||
|
||||
###################################### Perform reformat
|
||||
reformatted_expected_summary_name = f"unit/music/{music_preset}_updated_tags"
|
||||
|
||||
reformatted_subscription = Subscription.from_dict(
|
||||
config=config,
|
||||
preset_name=subscription_name,
|
||||
preset_dict={
|
||||
"preset": [music_preset],
|
||||
"music_tags": {"mood": "tired"},
|
||||
"overrides": {
|
||||
"url": "https://your.name.here",
|
||||
"music_directory": output_directory,
|
||||
"genre": "Rock N ROLL!",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
reformatted_transaction_log = reformatted_subscription.update_with_info_json(dry_run=False)
|
||||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=reformatted_transaction_log,
|
||||
transaction_log_summary_file_name=(f"{reformatted_expected_summary_name}.txt"),
|
||||
)
|
||||
assert_expected_downloads(
|
||||
output_directory=output_directory,
|
||||
dry_run=False,
|
||||
expected_download_summary_file_name=f"{reformatted_expected_summary_name}.json",
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue