From ef942b93d1e9bfc28bf607dfaf501cc7d9685e7b Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 24 Sep 2026 17:42:10 +0200 Subject: test(node): read the daemon's source wherever it is split Tests that read daemon.py now take their text from node_source (daemon.py, NodeDaemon's bases, the cli package once it exists). The CLI tests that sliced main() run the CLI instead. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-node/tests/test_roster_pairing.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'packages/meshbay-node/tests/test_roster_pairing.py') diff --git a/packages/meshbay-node/tests/test_roster_pairing.py b/packages/meshbay-node/tests/test_roster_pairing.py index 038f12c..ba16317 100644 --- a/packages/meshbay-node/tests/test_roster_pairing.py +++ b/packages/meshbay-node/tests/test_roster_pairing.py @@ -23,7 +23,7 @@ from meshbay_common.join import ROLE_MEMBER, ROLE_OPERATOR, join_transcript from meshbay_node.indexer.group_index import GroupIndex from meshbay_node.roster import Roster, hash_code, normalize_code from meshbay_node.transport.webrtc_server import WebRTCPeerSession -from node_source import session_method, webrtc_source +from node_source import daemon_source, session_method, webrtc_source from conftest import one_root @@ -528,9 +528,7 @@ def test_join_policy_is_carried_from_node_config(): The policy reaches the transport from node.toml. If it ever came from the hub instead, a hub could declare any group open and be handed its key. """ - daemon_src = (Path(__file__).parent.parent - / "src" / "meshbay_node" / "daemon.py").read_text(encoding="utf-8") - assert '"join_policy": group_cfg.join_policy' in daemon_src + assert '"join_policy": group_cfg.join_policy' in daemon_source() config_src = (Path(__file__).parent.parent / "src" / "meshbay_node" / "config.py").read_text(encoding="utf-8") @@ -883,8 +881,7 @@ def test_daemon_does_not_auto_pin_keystore_key(): Authority now comes from the roster, or from an explicit node.toml value. """ - source = (Path(__file__).parent.parent - / "src" / "meshbay_node" / "daemon.py").read_text(encoding="utf-8") + source = daemon_source() assert "Auto-pinning admin key" not in source assert "_resolve_admin_pk" not in source, ( "the auto-pin resolver is back — node authority must be established " @@ -896,7 +893,6 @@ def test_admin_authority_is_never_fetched_from_the_hub(): The fix M3 invites: ask the hub which key belongs to the operator. That would hand a malicious hub the node — the same substitution as H3, one level deeper. """ - src = Path(__file__).parent.parent / "src" / "meshbay_node" body = session_method("_verify_admin_sig") assert "operator_pks" in body, "the roster is where authority comes from" @@ -908,7 +904,7 @@ def test_admin_authority_is_never_fetched_from_the_hub(): f"_verify_admin_sig mentions {forbidden!r} — authority must come from " "the local roster and nothing else") - daemon = (src / "daemon.py").read_text(encoding="utf-8") + daemon = daemon_source() assert "has_operator()" in daemon, "the daemon reads authority from the roster" assert "admin_pk_ed25519" not in daemon, ( "the node.toml operator key is gone; it must not come back as a second " -- cgit v1.2.3