From d0007eb062742fd73a396260331c84a641b8788b Mon Sep 17 00:00:00 2001 From: clydebarrow <2366188+clydebarrow@users.noreply.github.com> Date: Mon, 19 Oct 2026 13:11:52 +1100 Subject: [PATCH] [entity_transport] Find an addressing peer's layers for the timeout check Co-Authored-By: Claude Opus 5.5 --- tests/unit_tests/test_entity_transport.py | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/unit_tests/test_entity_transport.py b/tests/unit_tests/test_entity_transport.py index a8fc882ac3a..e3e649de4bb 100644 --- a/tests/unit_tests/test_entity_transport.py +++ b/tests/unit_tests/test_entity_transport.py @@ -79,6 +79,33 @@ def test_timeout_not_with_session(setup_core, layers: dict, allowed: bool) -> No fv.full_config.reset(token) +def test_timeout_not_with_session_on_peer(setup_core) -> None: + """The layers of an addressing peer are found by the peer's id.""" + peers = [ + {CONF_ID: ID("plain", is_manual=True)}, + {CONF_ID: ID("with_session", is_manual=True), "session": {}}, + ] + token = fv.full_config.set( + { + "packet_interface": [ + {CONF_ID: ID("bus", is_manual=True), "addressing": {"peers": peers}} + ] + } + ) + try: + FINAL_VALIDATE_SCHEMA( + CONFIG_SCHEMA({"packet_interface": "plain", CONF_TIMEOUT: "1min"}) + ) + with pytest.raises(cv.Invalid, match="session"): + FINAL_VALIDATE_SCHEMA( + CONFIG_SCHEMA( + {"packet_interface": "with_session", CONF_TIMEOUT: "1min"} + ) + ) + finally: + fv.full_config.reset(token) + + def test_advertised_ids_unique(setup_core) -> None: """Two entities of one type cannot be sent with the same id.""" base = {"packet_interface": "link"}