Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/specify_cli/presets/command_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def preset_info(

if not pack_info:
console.print(
f"[red]Error:[/red] Preset '{preset_id}' not found (not installed and not in catalog)"
f"[red]Error:[/red] Preset '{safe_preset_id}' not found (not installed and not in catalog)"
)
raise typer.Exit(1)

Expand Down
23 changes: 23 additions & 0 deletions tests/specify_cli/presets/test_command_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,29 @@ def test_info_escapes_catalog_markup(self, project_dir):
# Tags are joined into a single line, so assert on the rendered join.
assert ", ".join(self.MARKUP_PRESET["tags"]) in output

def test_info_renders_missing_preset_id_literally(self, project_dir):
from unittest.mock import patch

from typer.testing import CliRunner

from specify_cli import app

catalog = seed_catalog(project_dir, [])
preset_id = "[/bold]missing"
with (
patch.object(Path, "cwd", return_value=project_dir),
patch.object(
PresetCatalog,
"get_active_catalogs",
return_value=default_catalog_entries(catalog),
),
):
result = CliRunner().invoke(app, ["preset", "info", preset_id])

assert isinstance(result.exception, SystemExit), result.exception
assert result.exit_code == 1
assert f"Preset '{preset_id}' not found" in strip_ansi(result.output)


class TestPresetInfoInstalledMarkup:
"""Locally installed preset metadata must render as literal text.
Expand Down
Loading