compilation tests
This commit is contained in:
parent
964530b162
commit
93fb3c1aa3
2 changed files with 137 additions and 37 deletions
|
|
@ -28,7 +28,7 @@ presets:
|
|||
season_number: "{collection_season_number}"
|
||||
season_number_padded: "{collection_season_number_padded}"
|
||||
|
||||
tv_show_collection_season_1:
|
||||
collection_season_1:
|
||||
generic:
|
||||
urls:
|
||||
- url: "{collection_season_1_url}"
|
||||
|
|
@ -52,7 +52,7 @@ presets:
|
|||
attributes:
|
||||
number: "1"
|
||||
|
||||
tv_show_collection_season_2:
|
||||
collection_season_2:
|
||||
generic:
|
||||
urls:
|
||||
- url: "{collection_season_2_url}"
|
||||
|
|
@ -70,7 +70,7 @@ presets:
|
|||
attributes:
|
||||
number: "2"
|
||||
|
||||
tv_show_collection_season_3:
|
||||
collection_season_3:
|
||||
generic:
|
||||
urls:
|
||||
- url: "{collection_season_3_url}"
|
||||
|
|
@ -88,7 +88,7 @@ presets:
|
|||
attributes:
|
||||
number: "3"
|
||||
|
||||
tv_show_collection_season_4:
|
||||
collection_season_4:
|
||||
generic:
|
||||
urls:
|
||||
- url: "{collection_season_4_url}"
|
||||
|
|
@ -106,7 +106,7 @@ presets:
|
|||
attributes:
|
||||
number: "4"
|
||||
|
||||
tv_show_collection_season_5:
|
||||
collection_season_5:
|
||||
generic:
|
||||
urls:
|
||||
- url: "{collection_season_5_url}"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import copy
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
|
||||
|
|
@ -9,9 +10,9 @@ from ytdl_sub.prebuilt_presets.tv_show import PrebuiltJellyfinTVShowPresets
|
|||
from ytdl_sub.prebuilt_presets.tv_show import PrebuiltKodiTVShowPresets
|
||||
from ytdl_sub.prebuilt_presets.tv_show import PrebuiltPlexTVShowPresets
|
||||
from ytdl_sub.subscriptions.subscription import Subscription
|
||||
from ytdl_sub.utils.exceptions import ValidationException
|
||||
|
||||
|
||||
class TestPrebuiltTVShowPresets:
|
||||
@pytest.mark.parametrize(
|
||||
"media_player_preset",
|
||||
[
|
||||
|
|
@ -28,6 +29,51 @@ class TestPrebuiltTVShowPresets:
|
|||
"season_by_year_month__episode_by_day",
|
||||
],
|
||||
)
|
||||
class TestPrebuiltTVShowPresets:
|
||||
def test_compilation(
|
||||
self,
|
||||
config,
|
||||
media_player_preset: str,
|
||||
tv_show_structure_preset: str,
|
||||
):
|
||||
parent_presets: List[str] = [media_player_preset, tv_show_structure_preset]
|
||||
_ = Subscription.from_dict(
|
||||
config=config,
|
||||
preset_name="preset_test",
|
||||
preset_dict={
|
||||
"preset": parent_presets,
|
||||
"overrides": {
|
||||
"url": "https://your.name.here",
|
||||
"tv_show_name": "test-compile",
|
||||
"tv_show_directory": "output_dir",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
def test_compilation_errors_missing_one(
|
||||
self,
|
||||
config,
|
||||
media_player_preset: str,
|
||||
tv_show_structure_preset: str,
|
||||
):
|
||||
parent_presets: List[str] = [media_player_preset, tv_show_structure_preset]
|
||||
for parent_preset in parent_presets:
|
||||
parent_presets_missing_one = copy.deepcopy(parent_presets).remove(parent_preset)
|
||||
|
||||
with pytest.raises(ValidationException):
|
||||
_ = Subscription.from_dict(
|
||||
config=config,
|
||||
preset_name="preset_test",
|
||||
preset_dict={
|
||||
"preset": parent_presets_missing_one,
|
||||
"overrides": {
|
||||
"url": "https://your.name.here",
|
||||
"tv_show_name": "test-compile",
|
||||
"tv_show_directory": "output_dir",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize("is_youtube_channel", [True, False])
|
||||
def test_non_collection_presets_compile(
|
||||
self,
|
||||
|
|
@ -75,6 +121,7 @@ class TestPrebuiltTVShowPresets:
|
|||
regenerate_expected_download_summary=True,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"media_player_preset",
|
||||
[
|
||||
|
|
@ -90,6 +137,59 @@ class TestPrebuiltTVShowPresets:
|
|||
"season_by_collection__episode_by_year_month_day_reversed",
|
||||
],
|
||||
)
|
||||
class TestPrebuiltTvShowCollectionPresets:
|
||||
@pytest.mark.parametrize("season_preset", ["collection_season_1", "collection_season_2"])
|
||||
def test_compilation(
|
||||
self,
|
||||
config,
|
||||
media_player_preset: str,
|
||||
tv_show_structure_preset: str,
|
||||
season_preset: str,
|
||||
):
|
||||
parent_presets: List[str] = [media_player_preset, tv_show_structure_preset, season_preset]
|
||||
_ = Subscription.from_dict(
|
||||
config=config,
|
||||
preset_name="preset_test",
|
||||
preset_dict={
|
||||
"preset": parent_presets,
|
||||
"overrides": {
|
||||
"url": "https://your.name.here",
|
||||
"tv_show_name": "test-compile",
|
||||
"tv_show_directory": "output_dir",
|
||||
f"{season_preset}_url": "https://your.name.here",
|
||||
f"{season_preset}_name": "test season name",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize("season_preset", ["collection_season_1", "collection_season_2"])
|
||||
def test_compilation_errors_missing_one(
|
||||
self,
|
||||
config,
|
||||
media_player_preset: str,
|
||||
tv_show_structure_preset: str,
|
||||
season_preset: str,
|
||||
):
|
||||
parent_presets: List[str] = [media_player_preset, tv_show_structure_preset, season_preset]
|
||||
for parent_preset in parent_presets:
|
||||
parent_presets_missing_one = copy.deepcopy(parent_presets).remove(parent_preset)
|
||||
|
||||
with pytest.raises(ValidationException):
|
||||
_ = Subscription.from_dict(
|
||||
config=config,
|
||||
preset_name="preset_test",
|
||||
preset_dict={
|
||||
"preset": parent_presets_missing_one,
|
||||
"overrides": {
|
||||
"url": "https://your.name.here",
|
||||
"tv_show_name": "test-compile",
|
||||
"tv_show_directory": "output_dir",
|
||||
f"{season_preset}_url": "https://your.name.here",
|
||||
f"{season_preset}_name": "test season name",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize("season_indices", [[1], [1, 2]])
|
||||
@pytest.mark.parametrize("is_youtube_channel", [True, False])
|
||||
def test_collection_presets_compile(
|
||||
|
|
@ -113,7 +213,7 @@ class TestPrebuiltTVShowPresets:
|
|||
|
||||
overrides: Dict[str, str] = {}
|
||||
for season_index in season_indices:
|
||||
parent_presets.append(f"tv_show_collection_season_{season_index}")
|
||||
parent_presets.append(f"collection_season_{season_index}")
|
||||
|
||||
overrides = dict(
|
||||
overrides,
|
||||
|
|
|
|||
Loading…
Reference in a new issue