diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-24 18:19:13 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-24 18:19:13 +0200 |
| commit | 6e9afe3e54ab6fb0162393150b7892655b4561d4 (patch) | |
| tree | f1cf20d891bf0d75dd206953bcec781f47ab7b15 /packages/meshbay-node/tests/test_root_paths_are_operator_only.py | |
| parent | a408a25af7b91abf729ec5fac7e5506437a86049 (diff) | |
| download | meshbay-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_root_paths_are_operator_only.py')
| -rw-r--r-- | packages/meshbay-node/tests/test_root_paths_are_operator_only.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/meshbay-node/tests/test_root_paths_are_operator_only.py b/packages/meshbay-node/tests/test_root_paths_are_operator_only.py index a18e9fa..e00f1cf 100644 --- a/packages/meshbay-node/tests/test_root_paths_are_operator_only.py +++ b/packages/meshbay-node/tests/test_root_paths_are_operator_only.py @@ -26,6 +26,8 @@ from meshbay_node import daemon as daemon_mod from meshbay_node import ops from meshbay_node.roots import RootSet +from conftest import patch_cli + def _roots(tmp_path: Path) -> RootSet: for name in ("Films", "Albums"): @@ -116,12 +118,14 @@ def test_the_cli_only_reads_fields_the_payload_carries(monkeypatch, tmp_path, ca return super().get(key, default) gid = "g" * 32 - monkeypatch.setattr(daemon_mod, "_daemon_api", lambda cfg, path, **kw: { + patch_cli(monkeypatch, "_daemon_api", lambda cfg, path, **kw: { "groups": [{"id": gid, "roots": [_Recording(offered)]}]}) - monkeypatch.setattr(daemon_mod, "_resolve_group", lambda cfg, g: gid) + patch_cli(monkeypatch, "_resolve_group", lambda cfg, g: gid) conf = tmp_path / "node.toml" conf.write_text('[hub]\nurl = "https://example.invalid"\n') - monkeypatch.setattr(daemon_mod, "DEFAULT_CONFIG_PATH", conf) + patch_cli(monkeypatch, "DEFAULT_CONFIG_PATH", conf) + # A stub missed would otherwise reach the node running on this machine. + monkeypatch.setenv("HOME", str(tmp_path / "home")) monkeypatch.setattr(sys, "argv", ["meshbay-node", "root", "list"]) daemon_mod.main() |