test(gateway): cover capability-gated approval IDs
This commit is contained in:
1 parent
918b9ddb63
commit
ecdd0af573
2 files changed
+11
-3
No files matched your search
@@ -374,7 +374,7 @@ def test_legacy_approval_records_run_id_for_response_relay():
|
||||
assert captured.get("url", "") == "http://gw:8642/v1/runs/run-legacy-1/approval", (
|
||||
f"approval respond must relay to the gateway run; got {captured.get('url')!r}"
|
||||
)
|
||||
assert captured["body"] == {"choice": "once", "approval_id": "appr-legacy-runid"}
|
||||
assert captured["body"] == {"choice": "once", "approval_id": ""}
|
||||
handler.send_response.assert_called_with(200)
|
||||
finally:
|
||||
with STREAMS_LOCK:
|
||||
@@ -697,7 +697,7 @@ def test_mirrored_run_id_survives_active_stream_loss():
|
||||
assert captured.get("url", "") == f"http://gw:8642/v1/runs/{run_id}/approval", (
|
||||
f"approval respond must relay to the mirrored gateway run; got {captured.get('url')!r}"
|
||||
)
|
||||
assert captured["body"] == {"choice": "once", "approval_id": approval_id}
|
||||
assert captured["body"] == {"choice": "once", "approval_id": ""}
|
||||
handler.send_response.assert_called_with(200)
|
||||
assert entry.event.is_set(), "mirrored gateway approval was not resolved"
|
||||
assert entry.result == "once"
|
||||
|
||||
@@ -305,7 +305,15 @@ def test_gateway_approval_event_translation():
|
||||
assert result["run_id"] == "run-999"
|
||||
assert result["approval_id"] == "appr-1"
|
||||
empty_id = _gateway_runs_approval_event({**payload, "approval_id": "", "id": ""})
|
||||
assert empty_id["approval_id"] == ""
|
||||
import api.route_approvals as approvals
|
||||
sid = "translation-empty-id"
|
||||
try:
|
||||
approvals.submit_gateway_pending_mirror(sid, empty_id)
|
||||
mirror = approvals.gateway_pending_mirror(sid, run_id="run-999")
|
||||
assert mirror["approval_id"]
|
||||
assert mirror.get("_gateway_agent_identity_v1") is not True
|
||||
finally:
|
||||
approvals._pending.pop(sid, None)
|
||||
|
||||
downgraded = _gateway_runs_approval_event({
|
||||
"command": "rm -rf /tmp/x",
|
||||
|
||||
Reference in new issue
Block a user