refactor(api): build list, search and session services through one launch_served

This commit is contained in:
imSp4rky
2026-11-29 14:28:47 -07:00
parent e41760c2b3
commit de2ffcb9bd
22 changed files with 444 additions and 280 deletions
+4 -2
View File
@@ -3,6 +3,7 @@
from __future__ import annotations
from pathlib import Path
from types import SimpleNamespace
from typing import Any
import click
@@ -10,6 +11,7 @@ import pytest
import unshackle.commands.dl as dl_module
from tests.admission import refusal
from tests.remote.sessions import launch_session
from unshackle.core.api import download_manager, handlers, key_policy
from unshackle.core.services import Services
@@ -55,13 +57,13 @@ def session_params(monkeypatch: pytest.MonkeyPatch, data: dict) -> dict:
def fake_instantiate(parent_ctx: click.Context, *args: object) -> object:
seen["params"] = parent_ctx.params
return object()
return SimpleNamespace()
monkeypatch.setattr(key_policy, "load_service_config", lambda service: {})
monkeypatch.setattr(handlers, "load_full_cdm", lambda *args: None)
monkeypatch.setattr(handlers.Services, "load", lambda service: None)
monkeypatch.setattr(handlers, "instantiate_service", fake_instantiate)
handlers.create_service_instance("EXAMPLE", "title", data, None, [], None)
launch_session("EXAMPLE", "title", data)
return seen["params"]