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).
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""Unit tests for the extracted ``hermes cron`` parser builder.
|
|
|
|
Confirms ``build_cron_parser`` wires up the same subactions, aliases, options,
|
|
and ``func=cmd_cron`` dispatch that lived inline in ``main()`` before the
|
|
god-file Phase 2 extraction.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
|
|
from hermes_cli.subcommands.cron import build_cron_parser
|
|
|
|
|
|
def _sentinel_handler(args): # pragma: no cover - only identity is asserted
|
|
return "cron-handler"
|
|
|
|
|
|
def _build():
|
|
parser = argparse.ArgumentParser(prog="hermes")
|
|
subparsers = parser.add_subparsers(dest="command")
|
|
build_cron_parser(subparsers, cmd_cron=_sentinel_handler)
|
|
return parser
|
|
|
|
|
|
|
|
|
|
def test_cron_edit_no_agent_tristate():
|
|
parser = _build()
|
|
# --no-agent -> True, --agent -> False, neither -> None
|
|
assert parser.parse_args(["cron", "edit", "j", "--no-agent"]).no_agent is True
|
|
assert parser.parse_args(["cron", "edit", "j", "--agent"]).no_agent is False
|
|
assert parser.parse_args(["cron", "edit", "j"]).no_agent is None
|
|
|
|
|
|
def test_cron_accept_hooks_flag_on_run_and_tick():
|
|
parser = _build()
|
|
# --accept-hooks is suppressed-default; present only when passed.
|
|
ns = parser.parse_args(["cron", "run", "jid", "--accept-hooks"])
|
|
assert ns.accept_hooks is True
|
|
ns2 = parser.parse_args(["cron", "tick", "--accept-hooks"])
|
|
assert ns2.accept_hooks is True
|