gabriel / muse public
test_agent_config_envelope.py python
55 lines 1.6 KB
Raw
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3 docs: docstring sprint contract→find-symbol — idiomatic run… Sonnet 4.6 patch 149 days ago
1 """Envelope tests for ``muse agent-config`` subcommands."""
2 from __future__ import annotations
3 import json, os, pathlib
4 import pytest
5 from tests.cli_test_helper import CliRunner
6
7 runner = CliRunner()
8
9 def _invoke(repo, args):
10 saved = os.getcwd()
11 try:
12 os.chdir(repo)
13 return runner.invoke(None, args)
14 finally:
15 os.chdir(saved)
16
17 @pytest.fixture()
18 def repo(tmp_path):
19 saved = os.getcwd()
20 try:
21 os.chdir(tmp_path)
22 runner.invoke(None, ["init"])
23 finally:
24 os.chdir(saved)
25 return tmp_path
26
27 _CMDS = ["init", "status", "inspect"]
28
29 class TestAgentConfigEnvelope:
30 def _check(self, r):
31 assert r.exit_code == 0, r.output
32 d = json.loads(r.output)
33 for field in ("muse_version", "schema", "timestamp", "warnings"):
34 assert field in d, f"missing {field}"
35 assert "schema_version" not in d
36 return d
37
38 def test_init_envelope(self, repo):
39 self._check(_invoke(repo, ["agent-config", "init", "-j"]))
40
41 def test_status_envelope(self, repo):
42 _invoke(repo, ["agent-config", "init"])
43 self._check(_invoke(repo, ["agent-config", "status", "-j"]))
44
45 def test_inspect_envelope(self, repo):
46 _invoke(repo, ["agent-config", "init"])
47 self._check(_invoke(repo, ["agent-config", "inspect", "-j"]))
48
49 def test_sync_envelope(self, repo):
50 _invoke(repo, ["agent-config", "init"])
51 self._check(_invoke(repo, ["agent-config", "sync", "-j"]))
52
53 def test_read_envelope(self, repo):
54 _invoke(repo, ["agent-config", "init"])
55 self._check(_invoke(repo, ["agent-config", "read", "-j"]))
File History 1 commit
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3 docs: docstring sprint contract→find-symbol — idiomatic run… Sonnet 4.6 patch 149 days ago