gabriel / muse public
test_clone_envelope.py python
27 lines 915 B
Raw
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3 docs: docstring sprint contract→find-symbol — idiomatic run… Sonnet 4.6 patch 140 days ago
1 """Envelope tests for clone 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 TestCloneEnvelope:
19 def test_clone_already_exists_has_envelope(self):
20 # Cloning into the current directory (which already has .muse/) triggers
21 # the "already_exists" path immediately — no network call needed.
22 r = runner.invoke(None, ["clone", "http://example.com/repo", ".", "--json"])
23 # exits with USER_ERROR but must emit a JSON envelope on the first line
24 first_line = r.output.strip().splitlines()[0]
25 d = json.loads(first_line)
26 _check(d)
27 assert d["status"] == "already_exists"
File History 1 commit
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3 docs: docstring sprint contract→find-symbol — idiomatic run… Sonnet 4.6 patch 140 days ago