This commit is contained in:
Jesse Bannon 2024-09-29 23:58:26 -07:00
parent d2f3bb70ca
commit 600ec069c3

View file

@ -8,7 +8,7 @@ from ytdl_sub.subscriptions.subscription import Subscription
@pytest.fixture @pytest.fixture
def throtte_subscription_dict(output_directory) -> Dict: def throttle_subscription_dict(output_directory) -> Dict:
return { return {
"preset": [ "preset": [
"Kodi Music Videos", "Kodi Music Videos",
@ -16,6 +16,8 @@ def throtte_subscription_dict(output_directory) -> Dict:
"overrides": { "overrides": {
"url": "https://your.name.here", "url": "https://your.name.here",
"music_video_directory": output_directory, "music_video_directory": output_directory,
"bool_false_variable": "{ %bool(False) }",
"empty_string_variable": "",
}, },
"throttle_protection": { "throttle_protection": {
"sleep_per_download_s": { "sleep_per_download_s": {
@ -35,14 +37,14 @@ class TestThrottleProtectionPlugin:
self, self,
config, config,
subscription_name, subscription_name,
throtte_subscription_dict, throttle_subscription_dict,
output_directory, output_directory,
mock_download_collection_entries, mock_download_collection_entries,
): ):
subscription = Subscription.from_dict( subscription = Subscription.from_dict(
config=config, config=config,
preset_name=subscription_name, preset_name=subscription_name,
preset_dict=throtte_subscription_dict, preset_dict=throttle_subscription_dict,
) )
with ( with (
@ -76,24 +78,24 @@ class TestThrottleProtectionPlugin:
[ [
"", "",
False, False,
"{tp_bool_string}", "{bool_false_variable}",
"{tp_empty_string}", "{empty_string_variable}",
], ],
) )
def test_disabled( def test_disabled(
self, self,
config, config,
subscription_name, subscription_name,
throtte_subscription_dict, throttle_subscription_dict,
output_directory, output_directory,
mock_download_collection_entries, mock_download_collection_entries,
disable_value, disable_value,
): ):
throtte_subscription_dict["throttle_protection"]["enable"] = disable_value throttle_subscription_dict["throttle_protection"]["enable"] = disable_value
subscription = Subscription.from_dict( subscription = Subscription.from_dict(
config=config, config=config,
preset_name=subscription_name, preset_name=subscription_name,
preset_dict=throtte_subscription_dict, preset_dict=throttle_subscription_dict,
) )
with ( with (
@ -113,17 +115,17 @@ class TestThrottleProtectionPlugin:
self, self,
config, config,
subscription_name, subscription_name,
throtte_subscription_dict, throttle_subscription_dict,
output_directory, output_directory,
mock_download_collection_entries, mock_download_collection_entries,
): ):
throtte_subscription_dict["throttle_protection"] = { throttle_subscription_dict["throttle_protection"] = {
"max_downloads_per_subscription": {"max": 0} "max_downloads_per_subscription": {"max": 0}
} }
subscription = Subscription.from_dict( subscription = Subscription.from_dict(
config=config, config=config,
preset_name=subscription_name, preset_name=subscription_name,
preset_dict=throtte_subscription_dict, preset_dict=throttle_subscription_dict,
) )
with ( with (
@ -145,17 +147,17 @@ class TestThrottleProtectionPlugin:
self, self,
config, config,
subscription_name, subscription_name,
throtte_subscription_dict, throttle_subscription_dict,
output_directory, output_directory,
mock_download_collection_entries, mock_download_collection_entries,
): ):
throtte_subscription_dict["throttle_protection"] = { throttle_subscription_dict["throttle_protection"] = {
"subscription_download_probability": 0.0 "subscription_download_probability": 0.0
} }
subscription = Subscription.from_dict( subscription = Subscription.from_dict(
config=config, config=config,
preset_name=subscription_name, preset_name=subscription_name,
preset_dict=throtte_subscription_dict, preset_dict=throttle_subscription_dict,
) )
with ( with (