test_heartbeat_envelope.py
python
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3
docs: docstring sprint contract→find-symbol — idiomatic run…
Sonnet 4.6
patch
139 days ago
| 1 | """Envelope tests for muse coord heartbeat command.""" |
| 2 | from __future__ import annotations |
| 3 | import json |
| 4 | import pytest |
| 5 | from tests.cli_test_helper import CliRunner |
| 6 | |
| 7 | runner = CliRunner() |
| 8 | |
| 9 | _FIELDS = ("muse_version", "schema", "timestamp", "warnings") |
| 10 | |
| 11 | |
| 12 | def _check(d: dict) -> None: |
| 13 | for f in _FIELDS: |
| 14 | assert f in d, f"missing {f}" |
| 15 | assert "schema_version" not in d |
| 16 | |
| 17 | |
| 18 | class TestHeartbeatEnvelope: |
| 19 | def test_heartbeat_not_found_has_envelope(self): |
| 20 | # A well-formed UUID that doesn't exist yields a not_found JSON response. |
| 21 | r = runner.invoke( |
| 22 | None, |
| 23 | ["coord", "heartbeat", "00000000-0000-0000-0000-000000000000", |
| 24 | "--run-id", "test", "--json"], |
| 25 | ) |
| 26 | # exit_code 4 = NOT_FOUND |
| 27 | d = json.loads(r.output) |
| 28 | _check(d) |
| 29 | assert d["status"] == "not_found" |
File History
1 commit
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3
docs: docstring sprint contract→find-symbol — idiomatic run…
Sonnet 4.6
patch
139 days ago