mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-18 23:15:08 +00:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user