test(remote): add unit + e2e suite for remote-services subsystem

Covers RemoteClient/RemoteService, REST routes, handlers, SessionStore, InputBridge, DownloadQueueManager, errors, compression, and serve CLI. E2e tier opts in via --live and can auto-spawn its own serve.
This commit is contained in:
imSp4rky
2026-05-21 10:45:25 -06:00
parent 9c905ef7a3
commit 746b573711
29 changed files with 2541 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
"""E2E: interactive auth prompt round-trip.
For services that don't naturally prompt during ``authenticate()``, the
test still verifies the GET prompt endpoint returns the documented
shape (empty when no prompt pending).
"""
from __future__ import annotations
import pytest
pytestmark = [pytest.mark.live, pytest.mark.slow]
def test_prompt_endpoint_shape_without_pending(http_session, server_url: str, service_case) -> None:
service, conf = service_case
r = http_session.post(
f"{server_url}/api/session/create",
json={"service": service, "title_id": conf["title_url"]},
timeout=120,
)
if r.status_code >= 400:
pytest.skip(f"{service}: session creation failed: {r.status_code}")
sid = r.json()["session_id"]
try:
pr = http_session.get(f"{server_url}/api/session/{sid}/prompt", timeout=10)
assert pr.status_code in (200, 404), pr.text
if pr.status_code == 200:
body = pr.json()
assert "prompt" in body or "status" in body
finally:
http_session.delete(f"{server_url}/api/session/{sid}", timeout=30)
def test_prompt_post_unknown_session_returns_404(http_session, server_url: str) -> None:
r = http_session.post(
f"{server_url}/api/session/bogus-session-id/prompt",
json={"response": "irrelevant"},
timeout=10,
)
assert r.status_code == 404
def test_prompt_get_unknown_session_returns_404(http_session, server_url: str) -> None:
r = http_session.get(f"{server_url}/api/session/bogus-session-id/prompt", timeout=10)
assert r.status_code == 404