gabriel / muse public
test_coord_sync_envelope.py python
30 lines 1.2 KB
Raw
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3 docs: docstring sprint contract→find-symbol — idiomatic run… Sonnet 4.6 patch 143 days ago
1 """Envelope tests for coord sync 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 TestCoordSyncEnvelope:
19 def test_coord_sync_push_has_envelope(self):
20 # Push with no remote configured — will fail at hub resolution,
21 # but the no-records path (empty local state) exits before that.
22 r = runner.invoke(None, ["coord", "sync", "push", "--owner", "gabriel", "--slug", "muse", "--hub", "http://localhost:10003", "--json"])
23 # exit_code may be non-zero if hub is unreachable, but the JSON
24 # must still carry the envelope when records were gathered first.
25 # Use the simpler no-records path: if no coordination records exist
26 # the command exits 0 with an envelope.
27 # We accept either 0 (no records) or non-zero (hub error).
28 output = r.output.strip()
29 if output.startswith("{"):
30 _check(json.loads(output))
File History 1 commit
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3 docs: docstring sprint contract→find-symbol — idiomatic run… Sonnet 4.6 patch 143 days ago