gabriel / muse public
test_attributes_auth_envelope.py python
38 lines 1.3 KB
Raw
sha256:b636f72dcba9e190afb980bece906fa5b717fbde014b76ef023df8cb96e01eb9 docs: expand cache plan with all seven testing tiers and do… Sonnet 4.6 131 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 2 commits
sha256:b636f72dcba9e190afb980bece906fa5b717fbde014b76ef023df8cb96e01eb9 docs: expand cache plan with all seven testing tiers and do… Sonnet 4.6 131 days ago
sha256:7f9e2ef5286aedad9c1e6011b4c46ca27f39dbdad6e3409357e36b26e46b3b7c docs: docstring sprint for-each-ref→hotspots — idiomatic ru… Sonnet 4.6 patch 138 days ago