Files
hermes-agent/tests/hermes_cli/test_serve_command.py
teknium1 4b67380698 test: purge low-value tests, lane py13 (371 removed)
Change-detectors, tautologies, source-reading tests, redundant duplicates,
mock-echo tests and dead/unrunnable tests. Per-test rationale in the lane
ledger (category + reason for every removal).
2026-09-23 03:15:26 -07:00

48 lines
1.3 KiB
Python

"""Contract for the headless ``hermes serve`` backend command.
``serve`` is what the desktop app and remote backends launch — the same gateway
as ``dashboard`` (shared handler) but always headless, and decoupled in name so
the desktop never invokes ``dashboard``. These tests pin that contract:
- ``serve`` routes to the same handler as ``dashboard``;
- ``serve`` is headless by default, ``dashboard`` is not;
- both expose the identical server-runtime flag surface.
"""
from __future__ import annotations
import argparse
from hermes_cli.subcommands.dashboard import build_dashboard_parser
def _dash(args): # sentinel handler — identity-compared, never invoked
return args
def _register(args):
return args
def _parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser()
build_dashboard_parser(
parser.add_subparsers(dest="command"),
cmd_dashboard=_dash,
cmd_dashboard_register=_register,
)
return parser
def test_serve_is_a_headless_backend_but_dashboard_is_not():
# `headless_backend` is the flag cmd_dashboard reads to skip the web UI
# build; only `serve` carries it.
assert getattr(_parser().parse_args(["serve"]), "headless_backend", False) is True
assert getattr(_parser().parse_args(["dashboard"]), "headless_backend", False) is False