aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_cli_golden.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-24 18:19:13 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-24 18:19:13 +0200
commit6e9afe3e54ab6fb0162393150b7892655b4561d4 (patch)
treef1cf20d891bf0d75dd206953bcec781f47ab7b15 /packages/meshbay-node/tests/test_cli_golden.py
parenta408a25af7b91abf729ec5fac7e5506437a86049 (diff)
downloadmeshbay-6e9afe3e54ab6fb0162393150b7892655b4561d4.tar.gz
refactor(node): move the CLI out of daemon.py into cli/
Each `if args.command == ...` branch of main() becomes a function in cli/ (one module per family of verbs); the parser, the process setup and a VERBS table go to cli/parser.py and cli/dispatch.py. daemon.main runs the verb or starts the daemon. Tests patch the CLI through conftest.patch_cli; the CLI golden is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/tests/test_cli_golden.py')
-rw-r--r--packages/meshbay-node/tests/test_cli_golden.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/meshbay-node/tests/test_cli_golden.py b/packages/meshbay-node/tests/test_cli_golden.py
index ddaa82f..3d7b0c0 100644
--- a/packages/meshbay-node/tests/test_cli_golden.py
+++ b/packages/meshbay-node/tests/test_cli_golden.py
@@ -27,6 +27,8 @@ from meshbay_node import config as config_mod
from meshbay_node import daemon as daemon_mod
from test_cli_dispatch import VERBS
+from conftest import patch_cli
+
GOLDEN = Path(__file__).parent / "golden" / "cli.json"
# The verbs that ask first, asked and answered "no": test_cli_dispatch.py
# passes --yes to all of them.
@@ -78,9 +80,9 @@ def _run(argv: list[str], tmp_path: Path, capsys) -> dict:
conf.write_text('[hub]\nurl = "https://example.invalid"\n')
code = 0
with pytest.MonkeyPatch.context() as mp:
- mp.setattr(daemon_mod, "_daemon_api", fake_api)
- mp.setattr(daemon_mod, "_resolve_group", lambda cfg, g: "g" * 32)
- mp.setattr(daemon_mod, "DEFAULT_CONFIG_PATH", conf)
+ patch_cli(mp, "_daemon_api", fake_api)
+ patch_cli(mp, "_resolve_group", lambda cfg, g: "g" * 32)
+ patch_cli(mp, "DEFAULT_CONFIG_PATH", conf)
# The data directory and the keystore's default path come from these;
# left real, `status` would record the developer's own node.
mp.setenv("HOME", str(tmp_path / "home"))