"""Envelope tests for muse coord heartbeat command.""" from __future__ import annotations import json import pytest from tests.cli_test_helper import CliRunner runner = CliRunner() _FIELDS = ("muse_version", "schema", "timestamp", "warnings") def _check(d: dict) -> None: for f in _FIELDS: assert f in d, f"missing {f}" assert "schema_version" not in d class TestHeartbeatEnvelope: def test_heartbeat_not_found_has_envelope(self): # A well-formed UUID that doesn't exist yields a not_found JSON response. r = runner.invoke( None, ["coord", "heartbeat", "00000000-0000-0000-0000-000000000000", "--run-id", "test", "--json"], ) # exit_code 4 = NOT_FOUND d = json.loads(r.output) _check(d) assert d["status"] == "not_found"