Share the K1 live scene template and preserve idle media channels

This commit is contained in:
DCCONSTRUCTIONS
2026-09-07 16:38:39 +03:00
parent 309bdf759e
commit fa8ac760a1
49 changed files with 2813 additions and 2126 deletions
+38
View File
@@ -556,3 +556,41 @@ def test_native_node_rrd_opens_no_grpc_listener(monkeypatch):
subscriber.close()
subscriber.thread.join(6)
publisher.close()
@pytest.mark.parametrize("replacement", [False, True])
def test_preview_offer_cannot_cross_acquisition_boundary(replacement):
async def run():
device = bridge()
device.facade.current["acquisition"] = {"acquisition_id": "acq-one", "state": "running"}
device.facade.current["source_mode"] = "live"
class Peers:
opened = 0
closed = []
async def offer(self, _):
self.opened += 1
if replacement:
device.facade.current["acquisition"]["acquisition_id"] = "acq-two"
return {"peer_id": "synthetic-peer"}
async def close(self, identifier):
self.closed.append(identifier)
peers = Peers()
sensor = NodeK1Sensor(device, peers)
item = project_sensor(device.facade.current, "node-test")
command = {
"operation_id": "op_" + "a" * 32,
"action_id": "offer",
"session": {"device_id": item["id"], "session_id": "session-test"},
"parameters": {"acquisition_id": "acq-one" if replacement else "acq-old"},
}
with pytest.raises(ValueError):
await sensor.execute(command, "node-test")
assert peers.opened == int(replacement)
assert peers.closed == (["synthetic-peer"] if replacement else [])
assert all(action == "state.read" for action, _ in device.facade.actions)
asyncio.run(run())