test_placeholder_usage.py
1 """Tests for CLI placeholder text in config/setup output.""" 2 3 import os 4 from argparse import Namespace 5 from unittest.mock import patch 6 7 import pytest 8 9 from hermes_cli.config import config_command, show_config 10 from hermes_cli.setup import _print_setup_summary 11 12 13 def test_config_set_usage_marks_placeholders(capsys): 14 args = Namespace(config_command="set", key=None, value=None) 15 16 with pytest.raises(SystemExit) as exc: 17 config_command(args) 18 19 assert exc.value.code == 1 20 out = capsys.readouterr().out 21 assert "Usage: hermes config set <key> <value>" in out 22 23 24 def test_config_unknown_command_help_marks_placeholders(capsys): 25 args = Namespace(config_command="wat") 26 27 with pytest.raises(SystemExit) as exc: 28 config_command(args) 29 30 assert exc.value.code == 1 31 out = capsys.readouterr().out 32 assert "hermes config set <key> <value> Set a config value" in out 33 34 35 def test_show_config_marks_placeholders(tmp_path, capsys): 36 with patch.dict(os.environ, {"HERMES_HOME": str(tmp_path)}): 37 show_config() 38 39 out = capsys.readouterr().out 40 assert "hermes config set <key> <value>" in out 41 42 43 def test_setup_summary_marks_placeholders(tmp_path, capsys): 44 with patch.dict(os.environ, {"HERMES_HOME": str(tmp_path)}): 45 _print_setup_summary({"tts": {"provider": "edge"}}, tmp_path) 46 47 out = capsys.readouterr().out 48 assert "hermes config set <key> <value>" in out