mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-16 14:05:10 +00:00
feat(serve): add --cdm-only for a CDM backend with no REST API
Mounts only the pywidevine and pyplayready routes plus /api/health and the dashboard; no session store, service refresh or Swagger.
This commit is contained in:
@@ -286,3 +286,13 @@ async def test_auth_middleware_accepts_known_key(make_app, aiohttp_client) -> No
|
||||
resp = await client.get("/api/session/nonexistent", headers={"X-Secret-Key": "good-key"})
|
||||
# Auth passed; handler then 404s the session; anything other than 401 is fine here.
|
||||
assert resp.status != 401
|
||||
|
||||
|
||||
def test_setup_routes_cdm_only_keeps_health_and_dashboard_only() -> None:
|
||||
"""A CDM-only server answers health and the dashboard under /api/, nothing else."""
|
||||
app = web.Application()
|
||||
setup_routes(app, dashboard=True, cdm_only=True)
|
||||
paths = {path for _, path in collect_paths(app)}
|
||||
assert "/api/health" in paths
|
||||
assert any(path.startswith("/api/dashboard/") for path in paths)
|
||||
assert all(path == "/api/health" or path.startswith("/api/dashboard/") for path in paths)
|
||||
|
||||
@@ -181,3 +181,11 @@ def test_good_rate_limit_config_starts(runner: CliRunner, monkeypatch: pytest.Mo
|
||||
{"tiers": {"bot": {"rate_limit": 600}}, "users": {"k": {"username": "bot", "tier": "bot"}}},
|
||||
)
|
||||
assert started, output
|
||||
|
||||
|
||||
def test_serve_cdm_only_with_remote_only_rejected(runner: CliRunner) -> None:
|
||||
"""`--cdm-only` is mutually exclusive with `--api-only` and `--remote-only`; the check runs before config."""
|
||||
result = runner.invoke(serve, ["--cdm-only", "--remote-only"])
|
||||
assert result.exit_code != 0
|
||||
output = re.sub(r"\x1b\[[0-9;]*m", "", result.output or str(result.exception))
|
||||
assert "Cannot use --cdm-only" in output
|
||||
|
||||
Reference in New Issue
Block a user