Share the K1 live scene template and preserve idle media channels
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user