fix(api): cast download job options with the dl click types

cast_dl_params feeds ctx.params to dl() and dl.result() as on the CLI. A string lang value now returns 400 instead of splitting into letters, and -r accepts HDR10+.
This commit is contained in:
imSp4rky
2026-11-02 20:30:40 -07:00
parent dc188b7276
commit eeff83b820
18 changed files with 284 additions and 284 deletions
+2 -4
View File
@@ -5,8 +5,7 @@ import inspect
import pytest
from unshackle.commands.dl import dl
from unshackle.core.api import download_manager
from unshackle.core.api.handlers import DEFAULT_DOWNLOAD_PARAMS
from unshackle.core.api.handlers import DEFAULT_DOWNLOAD_PARAMS, cast_dl_params
from unshackle.core.utilities import missing_required_langs
@@ -110,10 +109,9 @@ def test_api_accepts_the_require_flags():
[("require_audio", []), ("require_video", []), ("audio_description_only", False), ("forced_subs_only", False)],
)
def test_api_reaches_dl_result(key, default):
# download_manager builds the dl.result kwargs by hand, so a missing key is a silent drop
assert DEFAULT_DOWNLOAD_PARAMS[key] == default
assert key in inspect.signature(dl.result).parameters
assert f'{key}=params.get("{key}", {default!r})' in inspect.getsource(download_manager)
assert cast_dl_params(dl.cli, {})[key] == default
@pytest.mark.parametrize(