feat: add daemon CLI rendering functions and tests

- Add print_daemon_table() function to display daemon list in rich table format
- Add print_daemon_detail() function to display individual daemon information
- Update render_output() to support daemon rendering with json/table formats
- Add test for daemon create and list CLI commands with output validation
- Integrate daemon output rendering into CLI workflow
This commit is contained in:
2026-05-14 06:38:21 +00:00
parent 3bb3ff547d
commit f4663f202e
2 changed files with 72 additions and 0 deletions
+25
View File
@@ -903,6 +903,31 @@ def test_cli_help_exposes_bot_token_commands() -> None:
assert "revoke" in result.stdout
def test_cli_daemon_create_and_list_render_entries() -> None:
repo = FakeRepo(_portfolio())
repo.create_user("alice", permission="read")
runner = build_runner(repo)
create_result = runner.invoke(
runner.app,
["daemon", "create", "alpha-bot", "--user", "alice", "--display-name", "Alpha Bot"],
)
list_result = runner.invoke(
runner.app,
["daemon", "list", "--user", "alice"],
)
assert create_result.exit_code == 0
assert "Daemon" in create_result.stdout
assert "alpha-bot" in create_result.stdout
assert "Alpha Bot" in create_result.stdout
assert list_result.exit_code == 0
assert "Daemons" in list_result.stdout
assert "alpha-bot" in list_result.stdout
assert "Alpha Bot" in list_result.stdout
def test_cli_service_token_issue_supports_json() -> None:
repo = FakeRepo(_portfolio())
user = repo.create_user("alice", permission="read")