HEL-879 verify endpoint grants and correct final window evidence
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user