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-hub/tests/test_app_settings_plugin.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'packages/meshbay-hub/tests/test_app_settings_plugin.py') diff --git a/packages/meshbay-hub/tests/test_app_settings_plugin.py b/packages/meshbay-hub/tests/test_app_settings_plugin.py index 027fee6..a1ecec7 100644 --- a/packages/meshbay-hub/tests/test_app_settings_plugin.py +++ b/packages/meshbay-hub/tests/test_app_settings_plugin.py @@ -15,6 +15,7 @@ fault this refactor's new import graph could otherwise reintroduce. import re from pathlib import Path +import node_tree import pytest STATIC = Path(__file__).resolve().parents[1] / "src" / "meshbay_hub" / "static" @@ -24,12 +25,6 @@ GROUP_PAGE = STATIC / "group-page.js" SETTINGS_UI = STATIC / "settings-ui.js" FOLDER_TREE = STATIC / "folder-tree.js" TRANSPORT = STATIC / "transport.js" -# parents[2] is `packages/` — the tests live at -# packages/meshbay-hub/tests/, so [0] is tests, [1] the package, [2] packages. -# Got this wrong once and the two cross-package checks below skipped silently, -# which is worse than not having them: a green run that measured nothing. -NODE_SERVER = (Path(__file__).resolve().parents[2] / "meshbay-node" / "src" - / "meshbay_node" / "transport" / "webrtc_server.py") PANES = ["chat-app-settings.js", "video-app-settings.js", "music-app-settings.js", "photos-app-settings.js"] @@ -89,11 +84,10 @@ def test_every_registered_app_has_a_key_the_node_would_accept(): key here that `ALLOWED_APPS` does not have is an app whose settings are refused by the node with no clue why. """ - node = NODE_SERVER - if not node.exists(): + if not node_tree.available(): pytest.skip("the node package is not in this checkout") m = re.search(r"ALLOWED_APPS = frozenset\(\{([^}]*)\}\)", - node.read_text(encoding="utf-8")) + node_tree.webrtc_source()) assert m, "ALLOWED_APPS moved" allowed = set(re.findall(r"'([^']+)'|\"([^\"]+)\"", m.group(1))) allowed = {a or b for a, b in allowed} @@ -207,9 +201,8 @@ def test_the_directory_op_is_signed_and_names_its_app(): assert "admin_challenge" in body and "_authorizeAdminOp" in body assert "${appKey}:${clean.join(',')}" in body - node = NODE_SERVER - if node.exists(): - assert 'f"{app}:{\',\'.join(clean)}"' in node.read_text(encoding="utf-8"), ( + if node_tree.available(): + assert 'f"{app}:{\',\'.join(clean)}"' in node_tree.webrtc_source(), ( "the node builds a different subject than the client signs") -- cgit v1.2.3