aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_cli_dispatch.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/tests/test_cli_dispatch.py')
-rw-r--r--packages/meshbay-node/tests/test_cli_dispatch.py36
1 files changed, 25 insertions, 11 deletions
diff --git a/packages/meshbay-node/tests/test_cli_dispatch.py b/packages/meshbay-node/tests/test_cli_dispatch.py
index 1a01eba..cf91564 100644
--- a/packages/meshbay-node/tests/test_cli_dispatch.py
+++ b/packages/meshbay-node/tests/test_cli_dispatch.py
@@ -261,18 +261,32 @@ def test_a_removed_verb_says_what_replaced_it():
"the message does not name what replaced it")
-def test_the_help_does_not_offer_the_old_upload_directory_as_current():
+def test_there_is_no_way_to_create_a_group_in_the_old_shape():
"""
- `--upload-dir` still works — an existing script passing it keeps working —
- but the help has to say it is the old spelling, or it reads as the way to
- do this.
+ `--upload-dir` is gone, and documenting it as deprecated was the wrong
+ answer — which is what it got at first.
+
+ It wrote `upload_dir` into a brand-new `[[groups]]` block, and
+ `GroupConfig.__post_init__` reads that by forcing *every other root
+ read-only* and appending that path as the one writable one. So
+ `group add --dir X --writable --upload-dir Y` silently made X read-only:
+ two mechanisms deciding which directories accept uploads, one of them
+ invisible, in a group created after the model that replaced it.
+
+ Reading it stays — an existing node.toml must keep working, and that is the
+ only legitimate use. Writing it does not.
"""
import inspect
source = inspect.getsource(daemon_mod.main)
- # The whole call, not just its first string: an adjacent-literal help text
- # is several strings, and matching only the first is how a test passes over
- # the half that carries the meaning.
- start = source.index('"--upload-dir"')
- call = source[start:source.index("parser.add_argument", start + 1)]
- assert "deprecated" in call.lower()
- assert "root add" in call, "it does not name the replacement"
+ assert "--upload-dir" not in source, (
+ "the CLI can still create a group in the pre-RO/RW shape")
+
+ from meshbay_node import ops
+ params = inspect.signature(ops.attach_group).parameters
+ assert "upload_dir" not in params, (
+ "attach_group still writes the legacy key")
+
+ # The read path is deliberately untouched.
+ from meshbay_node.config import GroupConfig
+ assert "upload_dir" in inspect.getsource(GroupConfig), (
+ "an existing node.toml using upload_dir would stop working")