From 328b01a2dd545d70a078db8df1e91b02d65bfc9c Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Wed, 23 Sep 2026 22:25:28 +0200 Subject: test: read the WebRTC transport's source as a set of files Source-reading tests take their text from node_source (node) and node_tree (hub): webrtc_server.py plus anything under transport/webrtc/, so a check for something's absence keeps reading the code it guards if that code moves. test_node_source_scope holds the boundary. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-node/tests/test_roster_pairing.py | 9 +++------ 1 file changed, 3 insertions(+), 6 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 91191c1..038f12c 100644 --- a/packages/meshbay-node/tests/test_roster_pairing.py +++ b/packages/meshbay-node/tests/test_roster_pairing.py @@ -23,6 +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 conftest import one_root @@ -568,9 +569,7 @@ def test_challenge_carries_node_pk_in_source(): Belt and braces for the above: the field must be in the message the node builds, whatever the surrounding handshake does. """ - source = (Path(__file__).parent.parent - / "src" / "meshbay_node" / "transport" - / "webrtc_server.py").read_text(encoding="utf-8") + source = webrtc_source() challenge = source[source.find("MNP.HANDSHAKE_CHALLENGE,"):] challenge = challenge[:challenge.find("})")] assert "node_pk" in challenge, ( @@ -899,9 +898,7 @@ def test_admin_authority_is_never_fetched_from_the_hub(): """ src = Path(__file__).parent.parent / "src" / "meshbay_node" - verifier = (src / "transport" / "webrtc_server.py").read_text(encoding="utf-8") - body = verifier[verifier.index("async def _verify_admin_sig"):] - body = body[:body.index("\n def ", 1)] + body = session_method("_verify_admin_sig") assert "operator_pks" in body, "the roster is where authority comes from" # Past the docstring: it names what was removed on purpose, so a reader knows # not to put it back. What must not reappear is code. -- cgit v1.2.3