mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-26 19:05:13 +00:00
refactor(dl): check dl options once in a run plan shared by the CLI and the REST download job
This commit is contained in:
@@ -57,7 +57,8 @@ def test_kind_only_conflict(params, expected):
|
||||
|
||||
def test_api_rejects_a_conflict():
|
||||
assert validate_download_parameters({**BASE, "audio_description_only": True, "no_audio": True}) == (
|
||||
"Cannot use both audio_description_only and no_audio"
|
||||
"--audio-description-only cannot be used with --no-audio: --no-audio drops the tracks that "
|
||||
"--audio-description-only selects."
|
||||
)
|
||||
assert validate_download_parameters({**BASE, "audio_description_only": True, "audio_only": True}) is None
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ from langcodes import Language
|
||||
|
||||
from tests.lang_selection import test_kind_only_selection as harness
|
||||
from tests.lang_selection.test_track_selection import audio, episode, selection, standard, video
|
||||
from unshackle.core.run_plan import PlanError, check_options
|
||||
from unshackle.core.tracks.selection import Kept, Skip
|
||||
from unshackle.core.utilities import missing_required_langs
|
||||
|
||||
@@ -98,11 +99,9 @@ def test_every_kind_misses_in_one_reason() -> None:
|
||||
({"require_audio": ["-en"]}, "--require-audio: en"),
|
||||
],
|
||||
)
|
||||
def test_a_required_and_excluded_language_stops_the_run(
|
||||
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture, flags: dict[str, Any], clash: str
|
||||
) -> None:
|
||||
assert harness.run(monkeypatch, caplog, {1: {}}, **flags) == 1
|
||||
assert f"{clash} cannot be required and excluded at the same time." in caplog.text
|
||||
def test_a_required_and_excluded_language_is_refused(flags: dict[str, Any], clash: str) -> None:
|
||||
with pytest.raises(PlanError, match=f"^{clash} cannot be required and excluded at the same time.$"):
|
||||
check_options(flags)
|
||||
|
||||
|
||||
def test_a_language_override_does_not_inherit_the_lang_exclusions(
|
||||
|
||||
Reference in New Issue
Block a user