update 2. GTP-6, второй этап поправки ошибок
This commit is contained in:
@@ -10,28 +10,10 @@ from hockey_data.models import OperatorSession
|
||||
from tests.support import LocalTestDatabase
|
||||
|
||||
|
||||
class FakeWebSocket:
|
||||
def __init__(self) -> None:
|
||||
self.client = SimpleNamespace(host="127.0.0.1")
|
||||
self.sent: list[dict] = []
|
||||
self.closed = False
|
||||
|
||||
async def send_json(self, payload: dict) -> None:
|
||||
self.sent.append(payload)
|
||||
|
||||
async def close(self, **_kwargs) -> None:
|
||||
self.closed = True
|
||||
|
||||
from tests.test_agent_bridge import FakeWebSocket
|
||||
|
||||
async def _ack_latest(hub: VmixAgentHub, device_id: str, ws: FakeWebSocket) -> dict:
|
||||
command = None
|
||||
for _ in range(100):
|
||||
await asyncio.sleep(0)
|
||||
commands = [item for item in ws.sent if item.get("type") == "vmix.command"]
|
||||
if commands:
|
||||
command = commands[-1]
|
||||
break
|
||||
assert command is not None
|
||||
command = await ws.wait_for_message("vmix.command")
|
||||
await hub.receive_command_ack(
|
||||
device_id,
|
||||
{"type": "command.ack", "request_id": command["request_id"], "ok": True},
|
||||
|
||||
Reference in New Issue
Block a user