all tests now have files except rolling recent
This commit is contained in:
parent
111e15c29a
commit
c186af2adc
14 changed files with 408 additions and 106 deletions
|
|
@ -6,7 +6,6 @@ from typing import List
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from ytdl_sub.utils.file_handler import FileHandlerTransactionLog
|
|
||||||
from ytdl_sub.utils.file_handler import FileMetadata
|
from ytdl_sub.utils.file_handler import FileMetadata
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -72,14 +71,3 @@ class ExpectedDownloads:
|
||||||
f"MD5 hash for {str(expected_download.path)} does not match: "
|
f"MD5 hash for {str(expected_download.path)} does not match: "
|
||||||
f"{md5_hash} != {expected_md5_hash}"
|
f"{md5_hash} != {expected_md5_hash}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def assert_dry_run_files_logged(self, transaction_log: FileHandlerTransactionLog):
|
|
||||||
assert (
|
|
||||||
len(transaction_log.files_created) == self.file_count
|
|
||||||
), "Mismatch in number of created files"
|
|
||||||
|
|
||||||
for expected_download in self.expected_downloads:
|
|
||||||
expected_path = str(expected_download.path)
|
|
||||||
assert (
|
|
||||||
expected_path in transaction_log.files_created
|
|
||||||
), f"Expected {expected_path} to be a file but it is not"
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
Files created in 'FILL_IN'
|
||||||
|
----------------------------------------
|
||||||
|
.ytdl-sub-pz-download-archive.json
|
||||||
|
fanart.jpg
|
||||||
|
poster.jpg
|
||||||
|
tvshow.nfo
|
||||||
|
NFO tags:
|
||||||
|
tvshow:
|
||||||
|
title: Project / Zombie
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
Files created in 'FILL_IN'
|
||||||
|
----------------------------------------
|
||||||
|
.ytdl-sub-pz-download-archive.json
|
||||||
|
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.jpg
|
||||||
|
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.mp4
|
||||||
|
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.nfo
|
||||||
|
NFO tags:
|
||||||
|
episodedetails:
|
||||||
|
aired: 2018-10-29
|
||||||
|
episode: 1029
|
||||||
|
plot:
|
||||||
|
See the full trailer here: https://youtu.be/LN2e6idGluI
|
||||||
|
Discord: https://discord.gg/BQN7SSe
|
||||||
|
Website: https://www.projectzombie.net/
|
||||||
|
|
||||||
|
It has been about six years since the glory days of the original RP server. Hope to see many familiar faces in the revival of our great server.
|
||||||
|
|
||||||
|
Credits:
|
||||||
|
ALISON - Space Echo
|
||||||
|
https://www.youtube.com/watch?v=lPldcjlv3_Y
|
||||||
|
season: 2018
|
||||||
|
title: Jesse's Minecraft Server | Teaser Trailer
|
||||||
|
year: 2018
|
||||||
|
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id.jpg
|
||||||
|
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id.mp4
|
||||||
|
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id.nfo
|
||||||
|
NFO tags:
|
||||||
|
episodedetails:
|
||||||
|
aired: 2018-11-02
|
||||||
|
episode: 1102
|
||||||
|
plot:
|
||||||
|
IP: mc.jesse.id
|
||||||
|
Live Map: http://mc.jesse.id:8123
|
||||||
|
Discord: https://discord.gg/BQN7SSe
|
||||||
|
Website: https://www.projectzombie.net/
|
||||||
|
|
||||||
|
It has been about six years since the glory days of the original RP server. Hope to see many familiar faces in the revival of our great server.
|
||||||
|
|
||||||
|
The MC version is 1.13.x AND/OR 1.12.x
|
||||||
|
|
||||||
|
Credits:
|
||||||
|
ALISON - Space Echo
|
||||||
|
https://www.youtube.com/watch?v=lPldcjlv3_Y
|
||||||
|
season: 2018
|
||||||
|
title: Jesse's Minecraft Server | IP mc.jesse.id
|
||||||
|
year: 2018
|
||||||
|
fanart.jpg
|
||||||
|
poster.jpg
|
||||||
|
tvshow.nfo
|
||||||
|
NFO tags:
|
||||||
|
tvshow:
|
||||||
|
title: Project / Zombie
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
Files created in 'FILL_IN'
|
||||||
|
----------------------------------------
|
||||||
|
JMC - Jesse's Minecraft Server.jpg
|
||||||
|
JMC - Jesse's Minecraft Server.mkv
|
||||||
|
Timestamps of playlist videos in the merged file:
|
||||||
|
0:00: Jesse's Minecraft Server [Trailer - Feb.1]
|
||||||
|
5:23: Jesse's Minecraft Server [Trailer - Feb.27]
|
||||||
|
9:23: Jesse's Minecraft Server [Trailer - Mar.21]
|
||||||
|
JMC - Jesse's Minecraft Server.nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: JMC
|
||||||
|
title: Jesse's Minecraft Server
|
||||||
|
year: 2011
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
Files created in 'FILL_IN'
|
||||||
|
----------------------------------------
|
||||||
|
.ytdl-sub-jmc-download-archive.json
|
||||||
|
JMC - Jesse's Minecraft Server [Trailer - Feb.1].jpg
|
||||||
|
JMC - Jesse's Minecraft Server [Trailer - Feb.1].mp4
|
||||||
|
JMC - Jesse's Minecraft Server [Trailer - Feb.1].nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: JMC
|
||||||
|
title: Jesse's Minecraft Server [Trailer - Feb.1]
|
||||||
|
year: 2011
|
||||||
|
JMC - Jesse's Minecraft Server [Trailer - Feb.27].jpg
|
||||||
|
JMC - Jesse's Minecraft Server [Trailer - Feb.27].mp4
|
||||||
|
JMC - Jesse's Minecraft Server [Trailer - Feb.27].nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: JMC
|
||||||
|
title: Jesse's Minecraft Server [Trailer - Feb.27]
|
||||||
|
year: 2011
|
||||||
|
JMC - Jesse's Minecraft Server [Trailer - Mar.21].jpg
|
||||||
|
JMC - Jesse's Minecraft Server [Trailer - Mar.21].mp4
|
||||||
|
JMC - Jesse's Minecraft Server [Trailer - Mar.21].nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: JMC
|
||||||
|
title: Jesse's Minecraft Server [Trailer - Mar.21]
|
||||||
|
year: 2011
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
Files created in 'FILL_IN'
|
||||||
|
----------------------------------------
|
||||||
|
.ytdl-sub-jb-download-archive.json
|
||||||
|
j_b/[2021] Baby Santana's Dorian Groove/01 - Baby Santana's Dorian Groove.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Baby Santana's Dorian Groove
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: Baby Santana's Dorian Groove
|
||||||
|
track: 1
|
||||||
|
year: 2021
|
||||||
|
j_b/[2021] Baby Santana's Dorian Groove/folder.jpg
|
||||||
|
j_b/[2021] Purple Clouds/01 - Purple Clouds.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Purple Clouds
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: Purple Clouds
|
||||||
|
track: 1
|
||||||
|
year: 2021
|
||||||
|
j_b/[2021] Purple Clouds/folder.jpg
|
||||||
|
j_b/[2022] Acoustic Treats/01 - 20160426 184214.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: 20160426 184214
|
||||||
|
track: 1
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/02 - 20160502 123150.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: 20160502 123150
|
||||||
|
track: 2
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/03 - 20160504 143832.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: 20160504 143832
|
||||||
|
track: 3
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/04 - 20160601 221234.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: 20160601 221234
|
||||||
|
track: 4
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/05 - 20160601 222440.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: 20160601 222440
|
||||||
|
track: 5
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/06 - 20170604 190236.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: 20170604 190236
|
||||||
|
track: 6
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/07 - 20170612 193646.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: 20170612 193646
|
||||||
|
track: 7
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/08 - 20170628 215206.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: 20170628 215206
|
||||||
|
track: 8
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/09 - Finding Home.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: Finding Home
|
||||||
|
track: 9
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/10 - Shallow Water WIP.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: Shallow Water WIP
|
||||||
|
track: 10
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/11 - Untold History.mp3
|
||||||
|
Music Tags:
|
||||||
|
album: Acoustic Treats
|
||||||
|
albumartist: j_b
|
||||||
|
artist: j_b
|
||||||
|
genre: Unset
|
||||||
|
title: Untold History
|
||||||
|
track: 11
|
||||||
|
year: 2022
|
||||||
|
j_b/[2022] Acoustic Treats/folder.jpg
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
Files created in 'FILL_IN'
|
||||||
|
----------------------------------------
|
||||||
|
Project Zombie - 1-6.Intro.mp4
|
||||||
|
0:00 - 0:10
|
||||||
|
Project Zombie - 2-6.Part 1.mp4
|
||||||
|
0:10 - 0:20
|
||||||
|
Project Zombie - 3-6.Part 2.mp4
|
||||||
|
0:20 - 0:30
|
||||||
|
Project Zombie - 4-6.Part 3.mp4
|
||||||
|
0:30 - 0:40
|
||||||
|
Project Zombie - 5-6.Part 4.mp4
|
||||||
|
0:40 - 1:01
|
||||||
|
Project Zombie - 6-6.Part 5.mp4
|
||||||
|
1:01 - 1:28
|
||||||
|
Project Zombie - Intro.jpg
|
||||||
|
Project Zombie - Intro.nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: Project Zombie
|
||||||
|
title: Intro
|
||||||
|
year: 2010
|
||||||
|
Project Zombie - Part 1.jpg
|
||||||
|
Project Zombie - Part 1.nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: Project Zombie
|
||||||
|
title: Part 1
|
||||||
|
year: 2010
|
||||||
|
Project Zombie - Part 2.jpg
|
||||||
|
Project Zombie - Part 2.nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: Project Zombie
|
||||||
|
title: Part 2
|
||||||
|
year: 2010
|
||||||
|
Project Zombie - Part 3.jpg
|
||||||
|
Project Zombie - Part 3.nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: Project Zombie
|
||||||
|
title: Part 3
|
||||||
|
year: 2010
|
||||||
|
Project Zombie - Part 4.jpg
|
||||||
|
Project Zombie - Part 4.nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: Project Zombie
|
||||||
|
title: Part 4
|
||||||
|
year: 2010
|
||||||
|
Project Zombie - Part 5.jpg
|
||||||
|
Project Zombie - Part 5.nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: Project Zombie
|
||||||
|
title: Part 5
|
||||||
|
year: 2010
|
||||||
11
tests/e2e/resources/transaction_log_summaries/test_video.txt
Normal file
11
tests/e2e/resources/transaction_log_summaries/test_video.txt
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
Files created in 'FILL_IN'
|
||||||
|
----------------------------------------
|
||||||
|
JMC - Oblivion Mod 'Falcor' p.1.jpg
|
||||||
|
JMC - Oblivion Mod 'Falcor' p.1.mp4
|
||||||
|
JMC - Oblivion Mod 'Falcor' p.1.nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: JMC
|
||||||
|
title: Oblivion Mod "Falcor" p.1
|
||||||
|
year: 2010
|
||||||
|
|
@ -3,6 +3,7 @@ from pathlib import Path
|
||||||
import pytest
|
import pytest
|
||||||
from e2e.expected_download import ExpectedDownloadFile
|
from e2e.expected_download import ExpectedDownloadFile
|
||||||
from e2e.expected_download import ExpectedDownloads
|
from e2e.expected_download import ExpectedDownloads
|
||||||
|
from e2e.expected_transaction_log import assert_transaction_log_matches
|
||||||
|
|
||||||
from ytdl_sub.config.config_file import ConfigFile
|
from ytdl_sub.config.config_file import ConfigFile
|
||||||
from ytdl_sub.config.preset import Preset
|
from ytdl_sub.config.preset import Preset
|
||||||
|
|
@ -93,14 +94,15 @@ class TestSoundcloudDiscography:
|
||||||
expected md5 file hashes.
|
expected md5 file hashes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("dry_run", [True, False])
|
||||||
def test_discography_download(
|
def test_discography_download(
|
||||||
self, discography_subscription, expected_discography_download, output_directory
|
self, discography_subscription, expected_discography_download, output_directory, dry_run
|
||||||
):
|
):
|
||||||
discography_subscription.download()
|
transaction_log = discography_subscription.download(dry_run=dry_run)
|
||||||
|
assert_transaction_log_matches(
|
||||||
|
output_directory=output_directory,
|
||||||
|
transaction_log=transaction_log,
|
||||||
|
transaction_log_summary_file_name="test_soundcloud_discography.txt",
|
||||||
|
)
|
||||||
|
if not dry_run:
|
||||||
expected_discography_download.assert_files_exist(relative_directory=output_directory)
|
expected_discography_download.assert_files_exist(relative_directory=output_directory)
|
||||||
|
|
||||||
def test_discography_dry_run(
|
|
||||||
self, discography_subscription, expected_discography_download, output_directory
|
|
||||||
):
|
|
||||||
transaction_log = discography_subscription.download(dry_run=True)
|
|
||||||
expected_discography_download.assert_dry_run_files_logged(transaction_log=transaction_log)
|
|
||||||
|
|
|
||||||
|
|
@ -293,26 +293,34 @@ class TestChannelAsKodiTvShow:
|
||||||
expected md5 file hashes.
|
expected md5 file hashes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("dry_run", [True, False])
|
||||||
def test_full_channel_download(
|
def test_full_channel_download(
|
||||||
self, full_channel_subscription, expected_full_channel_download, output_directory
|
self, full_channel_subscription, expected_full_channel_download, output_directory, dry_run
|
||||||
):
|
):
|
||||||
full_channel_subscription.download()
|
transaction_log = full_channel_subscription.download(dry_run=dry_run)
|
||||||
expected_full_channel_download.assert_files_exist(relative_directory=output_directory)
|
|
||||||
|
|
||||||
def test_full_channel_dry_run(
|
|
||||||
self, full_channel_subscription, expected_full_channel_download, output_directory
|
|
||||||
):
|
|
||||||
transaction_log = full_channel_subscription.download(dry_run=True)
|
|
||||||
assert_transaction_log_matches(
|
assert_transaction_log_matches(
|
||||||
output_directory=output_directory,
|
output_directory=output_directory,
|
||||||
transaction_log=transaction_log,
|
transaction_log=transaction_log,
|
||||||
transaction_log_summary_file_name="test_channel_as_kodi_tv_show__full_channel.txt",
|
transaction_log_summary_file_name="test_channel_full.txt",
|
||||||
)
|
)
|
||||||
|
if not dry_run:
|
||||||
|
expected_full_channel_download.assert_files_exist(relative_directory=output_directory)
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("dry_run", [True, False])
|
||||||
def test_recent_channel_download(
|
def test_recent_channel_download(
|
||||||
self, recent_channel_subscription, expected_recent_channel_download, output_directory
|
self,
|
||||||
|
recent_channel_subscription,
|
||||||
|
expected_recent_channel_download,
|
||||||
|
output_directory,
|
||||||
|
dry_run,
|
||||||
):
|
):
|
||||||
recent_channel_subscription.download()
|
transaction_log = recent_channel_subscription.download(dry_run=dry_run)
|
||||||
|
assert_transaction_log_matches(
|
||||||
|
output_directory=output_directory,
|
||||||
|
transaction_log=transaction_log,
|
||||||
|
transaction_log_summary_file_name="test_channel_recent.txt",
|
||||||
|
)
|
||||||
|
if not dry_run:
|
||||||
expected_recent_channel_download.assert_files_exist(relative_directory=output_directory)
|
expected_recent_channel_download.assert_files_exist(relative_directory=output_directory)
|
||||||
|
|
||||||
# try downloading again, ensure nothing more was downloaded
|
# try downloading again, ensure nothing more was downloaded
|
||||||
|
|
@ -320,45 +328,37 @@ class TestChannelAsKodiTvShow:
|
||||||
logger=ytdl_sub.downloaders.downloader.logger,
|
logger=ytdl_sub.downloaders.downloader.logger,
|
||||||
expected_message="ExistingVideoReached, stopping additional downloads",
|
expected_message="ExistingVideoReached, stopping additional downloads",
|
||||||
):
|
):
|
||||||
recent_channel_subscription.download()
|
transaction_log = recent_channel_subscription.download()
|
||||||
expected_recent_channel_download.assert_files_exist(relative_directory=output_directory)
|
assert_transaction_log_matches(
|
||||||
|
output_directory=output_directory,
|
||||||
def test_recent_channel_dry_run(
|
transaction_log=transaction_log,
|
||||||
self, recent_channel_subscription, expected_recent_channel_download, output_directory
|
transaction_log_summary_file_name="test_channel_no_additional_downloads.txt",
|
||||||
):
|
)
|
||||||
transaction_log = recent_channel_subscription.download(dry_run=True)
|
expected_recent_channel_download.assert_files_exist(
|
||||||
expected_recent_channel_download.assert_dry_run_files_logged(
|
relative_directory=output_directory
|
||||||
transaction_log=transaction_log
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("dry_run", [True, False])
|
||||||
def test_recent_channel_download__no_vids_in_range(
|
def test_recent_channel_download__no_vids_in_range(
|
||||||
self,
|
self,
|
||||||
recent_channel_no_vids_in_range_subscription,
|
recent_channel_no_vids_in_range_subscription,
|
||||||
expected_recent_channel_no_vids_in_range_download,
|
expected_recent_channel_no_vids_in_range_download,
|
||||||
output_directory,
|
output_directory,
|
||||||
|
dry_run,
|
||||||
):
|
):
|
||||||
recent_channel_no_vids_in_range_subscription.download()
|
# Run twice, ensure nothing changes between runs
|
||||||
|
for _ in range(2):
|
||||||
|
transaction_log = recent_channel_no_vids_in_range_subscription.download(dry_run=dry_run)
|
||||||
|
assert_transaction_log_matches(
|
||||||
|
output_directory=output_directory,
|
||||||
|
transaction_log=transaction_log,
|
||||||
|
transaction_log_summary_file_name="test_channel_no_additional_downloads.txt",
|
||||||
|
)
|
||||||
|
if not dry_run:
|
||||||
expected_recent_channel_no_vids_in_range_download.assert_files_exist(
|
expected_recent_channel_no_vids_in_range_download.assert_files_exist(
|
||||||
relative_directory=output_directory
|
relative_directory=output_directory
|
||||||
)
|
)
|
||||||
|
|
||||||
# Try again, make sure its the same
|
|
||||||
recent_channel_no_vids_in_range_subscription.download()
|
|
||||||
expected_recent_channel_no_vids_in_range_download.assert_files_exist(
|
|
||||||
relative_directory=output_directory
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_recent_channel_dry_run__no_vids_in_range(
|
|
||||||
self,
|
|
||||||
recent_channel_no_vids_in_range_subscription,
|
|
||||||
expected_recent_channel_no_vids_in_range_download,
|
|
||||||
output_directory,
|
|
||||||
):
|
|
||||||
transaction_log = recent_channel_no_vids_in_range_subscription.download(dry_run=True)
|
|
||||||
expected_recent_channel_no_vids_in_range_download.assert_dry_run_files_logged(
|
|
||||||
transaction_log=transaction_log
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_rolling_recent_channel_download(
|
def test_rolling_recent_channel_download(
|
||||||
self,
|
self,
|
||||||
recent_channel_subscription,
|
recent_channel_subscription,
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ from pathlib import Path
|
||||||
import pytest
|
import pytest
|
||||||
from e2e.expected_download import ExpectedDownloadFile
|
from e2e.expected_download import ExpectedDownloadFile
|
||||||
from e2e.expected_download import ExpectedDownloads
|
from e2e.expected_download import ExpectedDownloads
|
||||||
|
from e2e.expected_transaction_log import assert_transaction_log_matches
|
||||||
|
|
||||||
from ytdl_sub.config.config_file import ConfigFile
|
from ytdl_sub.config.config_file import ConfigFile
|
||||||
from ytdl_sub.config.preset import Preset
|
from ytdl_sub.config.preset import Preset
|
||||||
|
|
@ -81,14 +82,16 @@ class TestYoutubeMergePlaylist:
|
||||||
files exist and have the expected md5 file hashes.
|
files exist and have the expected md5 file hashes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("dry_run", [True, False])
|
||||||
def test_merge_playlist_download(
|
def test_merge_playlist_download(
|
||||||
self, playlist_subscription, expected_playlist_download, output_directory
|
self, playlist_subscription, expected_playlist_download, output_directory, dry_run
|
||||||
):
|
):
|
||||||
playlist_subscription.download()
|
transaction_log = playlist_subscription.download()
|
||||||
expected_playlist_download.assert_files_exist(relative_directory=output_directory)
|
assert_transaction_log_matches(
|
||||||
|
output_directory=output_directory,
|
||||||
|
transaction_log=transaction_log,
|
||||||
|
transaction_log_summary_file_name="test_merge_playlist.txt",
|
||||||
|
)
|
||||||
|
|
||||||
def test_merge_playlist_dry_run(
|
if not dry_run:
|
||||||
self, playlist_subscription, expected_playlist_download, output_directory
|
expected_playlist_download.assert_files_exist(relative_directory=output_directory)
|
||||||
):
|
|
||||||
transaction_log = playlist_subscription.download(dry_run=True)
|
|
||||||
expected_playlist_download.assert_dry_run_files_logged(transaction_log=transaction_log)
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import pytest
|
||||||
from conftest import assert_debug_log
|
from conftest import assert_debug_log
|
||||||
from e2e.expected_download import ExpectedDownloadFile
|
from e2e.expected_download import ExpectedDownloadFile
|
||||||
from e2e.expected_download import ExpectedDownloads
|
from e2e.expected_download import ExpectedDownloads
|
||||||
|
from e2e.expected_transaction_log import assert_transaction_log_matches
|
||||||
|
|
||||||
import ytdl_sub.downloaders.downloader
|
import ytdl_sub.downloaders.downloader
|
||||||
from ytdl_sub.config.config_file import ConfigFile
|
from ytdl_sub.config.config_file import ConfigFile
|
||||||
|
|
@ -135,13 +136,21 @@ class TestPlaylistAsKodiMusicVideo:
|
||||||
files exist and have the expected md5 file hashes.
|
files exist and have the expected md5 file hashes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("dry_run", [True, False])
|
||||||
def test_playlist_download(
|
def test_playlist_download(
|
||||||
self, playlist_subscription, expected_playlist_download, output_directory
|
self, playlist_subscription, expected_playlist_download, output_directory, dry_run
|
||||||
):
|
):
|
||||||
playlist_subscription.download()
|
transaction_log = playlist_subscription.download()
|
||||||
|
assert_transaction_log_matches(
|
||||||
|
output_directory=output_directory,
|
||||||
|
transaction_log=transaction_log,
|
||||||
|
transaction_log_summary_file_name="test_playlist.txt",
|
||||||
|
)
|
||||||
|
|
||||||
|
if not dry_run:
|
||||||
expected_playlist_download.assert_files_exist(relative_directory=output_directory)
|
expected_playlist_download.assert_files_exist(relative_directory=output_directory)
|
||||||
|
|
||||||
# After the playlist is downloaded, ensure another invocation will hit ExistingVideoReached
|
# Ensure another invocation will hit ExistingVideoReached
|
||||||
with assert_debug_log(
|
with assert_debug_log(
|
||||||
logger=ytdl_sub.downloaders.downloader.logger,
|
logger=ytdl_sub.downloaders.downloader.logger,
|
||||||
expected_message="ExistingVideoReached, stopping additional downloads",
|
expected_message="ExistingVideoReached, stopping additional downloads",
|
||||||
|
|
@ -149,22 +158,15 @@ class TestPlaylistAsKodiMusicVideo:
|
||||||
playlist_subscription.download()
|
playlist_subscription.download()
|
||||||
expected_playlist_download.assert_files_exist(relative_directory=output_directory)
|
expected_playlist_download.assert_files_exist(relative_directory=output_directory)
|
||||||
|
|
||||||
def test_playlist_dry_run(
|
@pytest.mark.parametrize("dry_run", [True, False])
|
||||||
self, playlist_subscription, expected_playlist_download, output_directory
|
|
||||||
):
|
|
||||||
file_transaction_log = playlist_subscription.download(dry_run=True)
|
|
||||||
expected_playlist_download.assert_dry_run_files_logged(transaction_log=file_transaction_log)
|
|
||||||
|
|
||||||
def test_single_video_download(
|
def test_single_video_download(
|
||||||
self, single_video_subscription, expected_single_video_download, output_directory
|
self, single_video_subscription, expected_single_video_download, output_directory, dry_run
|
||||||
):
|
):
|
||||||
single_video_subscription.download()
|
transaction_log = single_video_subscription.download()
|
||||||
expected_single_video_download.assert_files_exist(relative_directory=output_directory)
|
assert_transaction_log_matches(
|
||||||
|
output_directory=output_directory,
|
||||||
def test_single_video_dry_run(
|
transaction_log=transaction_log,
|
||||||
self, single_video_subscription, expected_single_video_download, output_directory
|
transaction_log_summary_file_name="test_video.txt",
|
||||||
):
|
|
||||||
file_transaction_log = single_video_subscription.download(dry_run=True)
|
|
||||||
expected_single_video_download.assert_dry_run_files_logged(
|
|
||||||
transaction_log=file_transaction_log
|
|
||||||
)
|
)
|
||||||
|
if not dry_run:
|
||||||
|
expected_single_video_download.assert_files_exist(relative_directory=output_directory)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import pytest
|
||||||
from conftest import assert_debug_log
|
from conftest import assert_debug_log
|
||||||
from e2e.expected_download import ExpectedDownloadFile
|
from e2e.expected_download import ExpectedDownloadFile
|
||||||
from e2e.expected_download import ExpectedDownloads
|
from e2e.expected_download import ExpectedDownloads
|
||||||
|
from e2e.expected_transaction_log import assert_transaction_log_matches
|
||||||
|
|
||||||
import ytdl_sub.downloaders.downloader
|
import ytdl_sub.downloaders.downloader
|
||||||
from ytdl_sub.config.config_file import ConfigFile
|
from ytdl_sub.config.config_file import ConfigFile
|
||||||
|
|
@ -120,12 +121,16 @@ class TestPlaylistAsKodiMusicVideo:
|
||||||
files exist and have the expected md5 file hashes.
|
files exist and have the expected md5 file hashes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("dry_run", [True, False])
|
||||||
def test_split_video_download(
|
def test_split_video_download(
|
||||||
self, single_video_subscription, expected_single_video_download, output_directory
|
self, single_video_subscription, expected_single_video_download, output_directory, dry_run
|
||||||
):
|
):
|
||||||
single_video_subscription.download()
|
transaction_log = single_video_subscription.download()
|
||||||
expected_single_video_download.assert_files_exist(relative_directory=output_directory)
|
assert_transaction_log_matches(
|
||||||
|
output_directory=output_directory,
|
||||||
|
transaction_log=transaction_log,
|
||||||
|
transaction_log_summary_file_name="test_split_video.txt",
|
||||||
|
)
|
||||||
|
|
||||||
def test_split_video_dry_run(self, single_video_subscription, expected_single_video_download):
|
if not dry_run:
|
||||||
transaction_log = single_video_subscription.download(dry_run=True)
|
expected_single_video_download.assert_files_exist(relative_directory=output_directory)
|
||||||
expected_single_video_download.assert_dry_run_files_logged(transaction_log=transaction_log)
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue