gabriel / muse public
test_attributes_auth_envelope.py python
38 lines 1.3 KB
Raw
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3 docs: docstring sprint contract→find-symbol — idiomatic run… Sonnet 4.6 patch 140 days ago
1 """Envelope tests for attributes and auth commands."""
2 from __future__ import annotations
3 import json
4 import pytest
5 from tests.cli_test_helper import CliRunner
6 runner = CliRunner()
7
8 _FIELDS = ("muse_version", "schema", "timestamp", "warnings")
9
10 def _check(d):
11 for f in _FIELDS:
12 assert f in d, f"missing {f}"
13 assert "schema_version" not in d
14
15 class TestAttributesEnvelope:
16 def test_list_has_envelope(self):
17 r = runner.invoke(None, ["attributes", "list", "--json"])
18 assert r.exit_code == 0, r.output
19 _check(json.loads(r.output))
20
21 def test_check_has_envelope(self):
22 r = runner.invoke(None, ["attributes", "check", "README.md", "--json"])
23 assert r.exit_code == 0, r.output
24 _check(json.loads(r.output))
25
26 def test_validate_has_envelope(self):
27 r = runner.invoke(None, ["attributes", "validate", "--json"])
28 assert r.exit_code == 0, r.output
29 _check(json.loads(r.output))
30
31 class TestAuthEnvelope:
32 def test_whoami_has_envelope(self):
33 r = runner.invoke(None, ["auth", "whoami", "--json"])
34 # May be logged in or not; either way JSON with envelope
35 if r.exit_code == 0:
36 _check(json.loads(r.output))
37 else:
38 pytest.skip("no identity configured")
File History 1 commit
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3 docs: docstring sprint contract→find-symbol — idiomatic run… Sonnet 4.6 patch 140 days ago