diff --git a/tests/core/test_hybrid_hdr10plus.py b/tests/core/test_hybrid_hdr10plus.py index 31301a4b..64d6b041 100644 --- a/tests/core/test_hybrid_hdr10plus.py +++ b/tests/core/test_hybrid_hdr10plus.py @@ -781,7 +781,8 @@ def test_the_hybrid_step_gets_the_base_alone_when_there_is_no_dv(tmp_path: Path) assert len(tracks) == 1 and tracks[0].range == Video.Range.HDR10P -def test_the_api_takes_generate_dv_with_any_range_as_dl_does() -> None: +def test_the_api_takes_generate_dv_with_any_range_as_dl_does(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr("unshackle.core.binaries.DoviTool", Path("dovi_tool")) for data in ({}, {"range": ["SDR"]}, {"range": ["DV"]}, {"range": ["HYBRID"]}, {"range": ["HDR10"]}): assert validate_download_parameters({"generate_dv": True, **data}) is None assert "boolean" in (validate_download_parameters({"generate_dv": "yes", "range": ["HYBRID"]}) or "") diff --git a/tests/core/test_metadata_id_validation.py b/tests/core/test_metadata_id_validation.py index 0552f171..73cc7a52 100644 --- a/tests/core/test_metadata_id_validation.py +++ b/tests/core/test_metadata_id_validation.py @@ -95,7 +95,8 @@ def test_api_refuses_two_ids(payload: dict) -> None: @pytest.mark.parametrize("payload", [{"tmdb_id": 27205}, {"imdb_id": "tt1375666"}, {"tvdb_id": 73871}, {}]) -def test_api_accepts_one_id(payload: dict) -> None: +def test_api_accepts_one_id(payload: dict, monkeypatch: pytest.MonkeyPatch) -> None: + with_keys(monkeypatch, tmdb_api_key="k", tvdb_api_key="k") assert validate_download_parameters(payload) is None diff --git a/tests/core/test_run_plan.py b/tests/core/test_run_plan.py index 2badfe70..52bc7c95 100644 --- a/tests/core/test_run_plan.py +++ b/tests/core/test_run_plan.py @@ -10,6 +10,7 @@ from click.core import ParameterSource from unshackle.commands.dl import dl from unshackle.core.api.errors import categorize_exception +from unshackle.core.config import config from unshackle.core.remote_protocol import APIErrorCode from unshackle.core.run_plan import PlanError, api_plan, bitrate_range, check_options from unshackle.core.tracks import Video @@ -101,6 +102,8 @@ def test_the_api_plan_records_where_each_value_came_from() -> None: assert ctx.params == plan.params -def test_dl_checks_the_plan_before_the_service_loads() -> None: +@pytest.mark.usefixtures("example_service") +def test_dl_checks_the_plan_before_the_service_loads(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr(config, "output_template", {"movies": "{title}"}) with pytest.raises(PlanError, match="--sample and --include-sample"): dl.cli.main(["--sample", "--include-sample", "EXAMPLE", "t"], standalone_mode=False) diff --git a/tests/remote/unit/test_download_gates_redaction.py b/tests/remote/unit/test_download_gates_redaction.py index d5684b14..85b672e7 100644 --- a/tests/remote/unit/test_download_gates_redaction.py +++ b/tests/remote/unit/test_download_gates_redaction.py @@ -4,6 +4,7 @@ and the secret redaction applied to job parameters and error/stderr fields.""" from __future__ import annotations from datetime import datetime +from pathlib import Path import pytest from aiohttp import web @@ -163,7 +164,8 @@ async def test_credential_allowed_when_enabled(stub_handler): assert isinstance(resp, web.Response) -def test_range_validation_accepts_hdr10p_and_alias(): +def test_range_validation_accepts_hdr10p_and_alias(monkeypatch): + monkeypatch.setattr("unshackle.core.binaries.DoviTool", Path("dovi_tool")) # canonical "HDR10P" and back-compat "HDR10+" both pass; mixed casing too assert handlers.validate_download_parameters({"range": ["HDR10P", "DV", "SDR"]}) is None assert handlers.validate_download_parameters({"range": ["hdr10+"]}) is None