-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEV] OutputOptions unit tests (#1078)
- Loading branch information
Showing
6 changed files
with
200 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
.../resources/expected_downloads_summaries/plugins/output_options/empty_info_json_thumb.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
".ytdl-sub-subscription_test-download-archive.json": "7c6fbd0631d7d02025f3da457ba203e3", | ||
"Season 2020/s2020.e000001 - Mock Entry 20-3.mp4": "7d2ee7fe8003ea63ece37dd2a441c123", | ||
"Season 2020/s2020.e000001 - Mock Entry 20-3.nfo": "dbe61f2c8ae41041773f713ba5376726", | ||
"Season 2020/s2020.e000002 - Mock Entry 20-2.mp4": "699017cd1b67ae216eda769bef413415", | ||
"Season 2020/s2020.e000002 - Mock Entry 20-2.nfo": "0f071078c9fa2569bbcb998664d40681", | ||
"Season 2020/s2020.e000003 - Mock Entry 20-1.mp4": "a16741d4fbf657d1de4c50493db14062", | ||
"Season 2020/s2020.e000003 - Mock Entry 20-1.nfo": "837a61dca11bbe1874ea07cb8ef8a7c9", | ||
"Season 2021/s2021.e000004 - Mock Entry 21-1.mp4": "7433153952b069a5674e2a3ed529b49b", | ||
"Season 2021/s2021.e000004 - Mock Entry 21-1.nfo": "8ee3845c514a411425b7e9198666b61c", | ||
"tvshow.nfo": "cccca1086b41af04d8ea004b1aa250e8" | ||
} |
120 changes: 120 additions & 0 deletions
120
tests/resources/transaction_log_summaries/plugins/output_options/empty_info_json_thumb.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
Files created: | ||
---------------------------------------- | ||
{output_directory} | ||
.ytdl-sub-subscription_test-download-archive.json | ||
tvshow.nfo | ||
NFO tags: | ||
tvshow: | ||
genre: ytdl-sub | ||
mpaa: TV-14 | ||
title: JMC | ||
{output_directory}/Season 2020 | ||
s2020.e000001 - Mock Entry 20-3.mp4 | ||
Video Tags: | ||
contentRating: TV-14 | ||
date: 2020-08-07 | ||
episode_id: 1 | ||
genre: ytdl-sub | ||
show: JMC | ||
synopsis: | ||
https://20-3.com | ||
|
||
The Description | ||
title: 2020-08-07 - Mock Entry 20-3 | ||
year: 2020 | ||
s2020.e000001 - Mock Entry 20-3.nfo | ||
NFO tags: | ||
episodedetails: | ||
aired: 2020-08-07 | ||
episode: 1 | ||
genre: ytdl-sub | ||
mpaa: TV-14 | ||
plot: | ||
https://20-3.com | ||
|
||
The Description | ||
season: 2020 | ||
title: 2020-08-07 - Mock Entry 20-3 | ||
year: 2020 | ||
s2020.e000002 - Mock Entry 20-2.mp4 | ||
Video Tags: | ||
contentRating: TV-14 | ||
date: 2020-08-08 | ||
episode_id: 2 | ||
genre: ytdl-sub | ||
show: JMC | ||
synopsis: | ||
https://20-2.com | ||
|
||
The Description | ||
title: 2020-08-08 - Mock Entry 20-2 | ||
year: 2020 | ||
s2020.e000002 - Mock Entry 20-2.nfo | ||
NFO tags: | ||
episodedetails: | ||
aired: 2020-08-08 | ||
episode: 2 | ||
genre: ytdl-sub | ||
mpaa: TV-14 | ||
plot: | ||
https://20-2.com | ||
|
||
The Description | ||
season: 2020 | ||
title: 2020-08-08 - Mock Entry 20-2 | ||
year: 2020 | ||
s2020.e000003 - Mock Entry 20-1.mp4 | ||
Video Tags: | ||
contentRating: TV-14 | ||
date: 2020-08-08 | ||
episode_id: 3 | ||
genre: ytdl-sub | ||
show: JMC | ||
synopsis: | ||
https://20-1.com | ||
|
||
The Description | ||
title: 2020-08-08 - Mock Entry 20-1 | ||
year: 2020 | ||
s2020.e000003 - Mock Entry 20-1.nfo | ||
NFO tags: | ||
episodedetails: | ||
aired: 2020-08-08 | ||
episode: 3 | ||
genre: ytdl-sub | ||
mpaa: TV-14 | ||
plot: | ||
https://20-1.com | ||
|
||
The Description | ||
season: 2020 | ||
title: 2020-08-08 - Mock Entry 20-1 | ||
year: 2020 | ||
{output_directory}/Season 2021 | ||
s2021.e000004 - Mock Entry 21-1.mp4 | ||
Video Tags: | ||
contentRating: TV-14 | ||
date: 2021-08-08 | ||
episode_id: 4 | ||
genre: ytdl-sub | ||
show: JMC | ||
synopsis: | ||
https://21-1.com | ||
|
||
The Description | ||
title: 2021-08-08 - Mock Entry 21-1 | ||
year: 2021 | ||
s2021.e000004 - Mock Entry 21-1.nfo | ||
NFO tags: | ||
episodedetails: | ||
aired: 2021-08-08 | ||
episode: 4 | ||
genre: ytdl-sub | ||
mpaa: TV-14 | ||
plot: | ||
https://21-1.com | ||
|
||
The Description | ||
season: 2021 | ||
title: 2021-08-08 - Mock Entry 21-1 | ||
year: 2021 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from typing import Dict | ||
|
||
import pytest | ||
from expected_download import assert_expected_downloads | ||
from expected_transaction_log import assert_transaction_log_matches | ||
|
||
from ytdl_sub.config.config_file import ConfigFile | ||
from ytdl_sub.subscriptions.subscription import Subscription | ||
|
||
|
||
@pytest.fixture | ||
def output_options_subscription_dict(output_directory) -> Dict: | ||
return { | ||
"preset": [ | ||
"jellyfin_tv_show_by_date", | ||
"season_by_year__episode_by_download_index", | ||
"chunk_initial_download", | ||
], | ||
"output_options": { | ||
"output_directory": output_directory, | ||
}, | ||
"overrides": { | ||
"tv_show_name": "JMC", | ||
"url": "https://your.name.here", | ||
}, | ||
} | ||
|
||
|
||
class TestOutputOptions: | ||
@pytest.mark.parametrize("dry_run", [True, False]) | ||
def test_empty_info_json_and_thumb( | ||
self, | ||
config: ConfigFile, | ||
subscription_name: str, | ||
output_options_subscription_dict: Dict, | ||
output_directory: str, | ||
mock_download_collection_entries, | ||
dry_run, | ||
): | ||
output_options_subscription_dict["output_options"]["thumbnail_name"] = "" | ||
output_options_subscription_dict["output_options"]["info_json_name"] = "" | ||
|
||
subscription = Subscription.from_dict( | ||
config=config, | ||
preset_name=subscription_name, | ||
preset_dict=output_options_subscription_dict, | ||
) | ||
|
||
with mock_download_collection_entries( | ||
is_youtube_channel=False, | ||
num_urls=1, | ||
is_extracted_audio=False, | ||
is_dry_run=dry_run, | ||
): | ||
transaction_log = subscription.download(dry_run=dry_run) | ||
|
||
assert_transaction_log_matches( | ||
output_directory=output_directory, | ||
transaction_log=transaction_log, | ||
transaction_log_summary_file_name="plugins/output_options/empty_info_json_thumb.txt", | ||
) | ||
assert_expected_downloads( | ||
output_directory=output_directory, | ||
dry_run=dry_run, | ||
expected_download_summary_file_name="plugins/output_options/empty_info_json_thumb.json", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters