Files
basicmachines-co-basic-memory/tests/cli/test_workspace_stub.py
Paul Hernandez f7304bf553 feat(cli): improve workspace and cloud bisync command discoverability (#905)
Signed-off-by: phernandez <paul@basicmachines.co>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 18:18:17 -05:00

32 lines
886 B
Python

"""Tests for the top-level `bm workspace` stub (issue #821).
The stub redirects users to `bm cloud workspace` instead of letting Typer emit a
bare "No such command 'workspace'." with exit code 2.
"""
import pytest
from typer.testing import CliRunner
from basic_memory.cli.app import app
# Importing the module registers the workspace_stub command on the top-level app.
import basic_memory.cli.commands.workspace # noqa: F401
runner = CliRunner()
@pytest.mark.parametrize(
"argv",
[
["workspace"],
["workspace", "list"],
["workspace", "set-default", "foo"],
],
)
def test_workspace_stub_redirects_to_cloud_workspace(argv):
"""Every `bm workspace ...` form exits 1 and points to `bm cloud workspace`."""
result = runner.invoke(app, argv)
assert result.exit_code == 1, result.output
assert "bm cloud workspace" in result.output