HEL-879 verify endpoint grants and correct final window evidence

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
总管
2026-10-28 00:11:44 +08:00
co-authored by multica-agent
parent 376653135b
commit be149cd6f7
3 changed files with 76 additions and 9 deletions
+10 -2
View File
@@ -12,6 +12,7 @@ from __future__ import annotations
import asyncio
import contextlib
import json
import socket
import sys
import tempfile
@@ -48,11 +49,18 @@ class FakeLiveKit:
if self.fail:
return httpx.Response(500)
if request.url.path.endswith("CreateDispatch"):
agent, room = _dispatch_fields(request.content)
body = json.loads(request.content)
agent, room = body["agentName"], body["room"]
assert request.headers["content-type"] == "application/json"
claims, _ = livekit_wire.decode_token(request.headers["authorization"].removeprefix("Bearer "))
assert claims["video"] == {"roomAdmin": True, "room": room}
self.dispatches.append({"agent_name": agent, "room": room})
return httpx.Response(200, json={"id": f"AD_{len(self.dispatches)}", "room": room})
if request.url.path.endswith("DeleteRoom"):
self.deleted.append(_dispatch_fields(request.content)[0])
assert request.headers["content-type"] == "application/json"
claims, _ = livekit_wire.decode_token(request.headers["authorization"].removeprefix("Bearer "))
assert claims["video"] == {"roomCreate": True}
self.deleted.append(json.loads(request.content)["room"])
return httpx.Response(200)
return httpx.Response(404)