diff --git a/tests/unit/prebuilt_presets/test_tv_show_by_date.py b/tests/unit/prebuilt_presets/test_tv_show_by_date.py index 115a2a61..2b21e050 100644 --- a/tests/unit/prebuilt_presets/test_tv_show_by_date.py +++ b/tests/unit/prebuilt_presets/test_tv_show_by_date.py @@ -1,6 +1,7 @@ import re import pytest +import yaml from ytdl_sub.script.utils.exceptions import UserThrownRuntimeError from ytdl_sub.subscriptions.subscription import Subscription @@ -25,57 +26,67 @@ class TestTvShowByDatePreset: }, ) - def test_backward_compatibility_single(self, default_config): - a = Subscription.from_dict( - config=default_config, - preset_name="a", - preset_dict={ - "preset": "Jellyfin TV Show by Date", - "overrides": {"tv_show_directory": "abc", "url": "test_1"}, - }, - ) - - b = Subscription.from_dict( - config=default_config, - preset_name="a", - preset_dict={ - "preset": "Jellyfin TV Show by Date", - "overrides": {"tv_show_directory": "abc", "subscription_value": "test_1"}, - }, - ) - - assert a.resolved_yaml() == b.resolved_yaml() - - def test_backward_compatibility_multi(self, default_config): - a = Subscription.from_dict( - config=default_config, - preset_name="a", - preset_dict={ - "preset": "Jellyfin TV Show by Date", - "overrides": {"tv_show_directory": "abc", "url": "test_1", "url2": "test_2"}, - }, - ) - - b = Subscription.from_dict( - config=default_config, - preset_name="a", - preset_dict={ - "preset": "Jellyfin TV Show by Date", - "overrides": { - "tv_show_directory": "abc", - "subscription_array": ["test_1", "test_2"], + def test_backward_compatibility_single_download(self, default_config): + a = yaml.safe_load( + Subscription.from_dict( + config=default_config, + preset_name="a", + preset_dict={ + "preset": "Jellyfin TV Show by Date", + "overrides": {"tv_show_directory": "abc", "url": "test_1"}, }, - }, + ).resolved_yaml() ) - c = Subscription.from_dict( - config=default_config, - preset_name="a", - preset_dict={ - "preset": "Jellyfin TV Show by Date", - "overrides": {"tv_show_directory": "abc", "urls": ["test_1", "test_2"]}, - }, + b = yaml.safe_load( + Subscription.from_dict( + config=default_config, + preset_name="a", + preset_dict={ + "preset": "Jellyfin TV Show by Date", + "overrides": {"tv_show_directory": "abc", "subscription_value": "test_1"}, + }, + ).resolved_yaml() ) - assert a.resolved_yaml() == b.resolved_yaml() - assert a.resolved_yaml() == c.resolved_yaml() + assert a["download"] == b["download"] + + def test_backward_compatibility_multi_download(self, default_config): + a = yaml.safe_load( + Subscription.from_dict( + config=default_config, + preset_name="a", + preset_dict={ + "preset": "Jellyfin TV Show by Date", + "overrides": {"tv_show_directory": "abc", "url": "test_1", "url2": "test_2"}, + }, + ).resolved_yaml() + ) + + b = yaml.safe_load( + Subscription.from_dict( + config=default_config, + preset_name="a", + preset_dict={ + "preset": "Jellyfin TV Show by Date", + "overrides": { + "tv_show_directory": "abc", + "subscription_array": ["test_1", "test_2"], + }, + }, + ).resolved_yaml() + ) + + c = yaml.safe_load( + Subscription.from_dict( + config=default_config, + preset_name="a", + preset_dict={ + "preset": "Jellyfin TV Show by Date", + "overrides": {"tv_show_directory": "abc", "urls": ["test_1", "test_2"]}, + }, + ).resolved_yaml() + ) + + assert a["download"] == b["download"] + assert a["download"] == c["download"]