Show live feedback for remote request actions
Magent CI/CD / verify (push) Successful in 10m51s
Magent CI/CD / deploy-prod (push) Skipped
Magent CI/CD / deploy-beta (push) Successful in 15s

This commit is contained in:
2026-08-30 21:23:20 +12:00
parent 02245d365e
commit 963506d098
9 changed files with 666 additions and 29 deletions
+40
View File
@@ -20,6 +20,14 @@ from backend.app.routers import site as site_router
from backend.app.routers import status as status_router
from backend.app.security import PASSWORD_POLICY_MESSAGE, validate_password_policy
from backend.app.services import password_reset
from backend.app.services.operation_progress import (
begin_operation,
finish_operation,
finish_remote_call,
get_operation,
reset_operation,
start_remote_call,
)
from backend.app.services.snapshot import _build_presentation, _episode_availability, _torrent_progress
@@ -142,6 +150,38 @@ class ServiceStatusTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("credentials", result["message"].lower())
class OperationProgressTests(unittest.TestCase):
def test_remote_interaction_is_visible_until_operation_completes(self) -> None:
operation_id = "operation-progress-test"
token = begin_operation(
operation_id,
label="Recheck request status",
path="/requests/3914/actions/recheck",
)
try:
event_id = start_remote_call("Radarr")
active = get_operation(operation_id)
self.assertEqual(active["status"], "running")
self.assertEqual(active["events"][-1]["service"], "Radarr")
self.assertEqual(active["events"][-1]["state"], "active")
finish_remote_call(
event_id,
success=True,
status_code=200,
message="Radarr responded in 0.2s.",
)
finish_operation(operation_id, success=True, status_code=200)
finally:
reset_operation(token)
completed = get_operation(operation_id)
self.assertEqual(completed["status"], "complete")
self.assertEqual(completed["events"][-2]["state"], "complete")
self.assertEqual(completed["events"][-2]["status_code"], 200)
self.assertEqual(completed["events"][-1]["service"], "Magent")
class SiteInfoTests(unittest.TestCase):
def test_site_public_exposes_requests_navigation_toggle(self) -> None:
runtime = SimpleNamespace(