From c2dabdb870ecd8fd8ea6392e44258de02e9ad467 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 24 Sep 2026 17:44:08 +0200 Subject: test(node): keep the CLI dispatch test off the developer's node The stub left HOME and config.DEFAULT_CONFIG_PATH real: every run wrote TEST-CODE over ~/.local/share/meshbay/invite-code and pair-code, and `status` read the real keystore and asked the running node. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-node/tests/test_cli_dispatch.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'packages') diff --git a/packages/meshbay-node/tests/test_cli_dispatch.py b/packages/meshbay-node/tests/test_cli_dispatch.py index d73dfcf..26ffb05 100644 --- a/packages/meshbay-node/tests/test_cli_dispatch.py +++ b/packages/meshbay-node/tests/test_cli_dispatch.py @@ -113,6 +113,14 @@ def stub_daemon(monkeypatch, tmp_path): conf = tmp_path / "node.toml" conf.write_text('[hub]\nurl = "https://example.invalid"\n') monkeypatch.setattr(daemon_mod, "DEFAULT_CONFIG_PATH", conf) + # And a home of its own: the data directory (where `member invite` and + # `operator pair` write their code, where `status` finds the run token of + # a live node) and the keystore's default path are both derived from it. + # Without this, every run wrote TEST-CODE over the developer's own + # invite-code and asked their running node for its status. + from meshbay_node import config as config_mod + monkeypatch.setenv("HOME", str(tmp_path / "home")) + monkeypatch.setattr(config_mod, "DEFAULT_CONFIG_PATH", conf) # No interactive prompt left to hang on. monkeypatch.setattr("builtins.input", lambda *a: "n") -- cgit v1.2.3