Files
zerto-ai-rewind/tests/test_catalog.py
T
claude 38ba9c1b50 feat(poc): rewind MCP, skill, and recover-ladder docs
Initial PoC: find_protection, tagged checkpoints, FLR, mutating catalog.
Lab 10.9 status enums (0=Initializing, 1=MeetingSLA). Credentials stay in gitignored config.json.
2026-09-21 12:09:11 -04:00

34 lines
986 B
Python

import json
from pathlib import Path
from zerto_rewind_mcp.catalog import CatalogEntry, MutatingCatalog, entry_from_dict
def test_add_and_get(tmp_path: Path):
path = tmp_path / "config.json"
path.write_text(
json.dumps({"zerto_url": "https://zvm", "mutating_tools": []}),
encoding="utf-8",
)
cat = MutatingCatalog(path=path)
cat.add(CatalogEntry(server="ssh", tool="exec", vm_arg="host", notes="guest shell"))
found = cat.get("SSH", "Exec")
assert found is not None
assert found.vm_arg == "host"
saved = json.loads(path.read_text(encoding="utf-8"))
assert saved["zerto_url"] == "https://zvm"
assert saved["mutating_tools"][0]["tool"] == "exec"
def test_unlisted_is_missing():
cat = MutatingCatalog()
assert cat.get("foo", "bar") is None
def test_entry_requires_fields():
try:
entry_from_dict({"server": "ssh"})
raise AssertionError("expected ValueError")
except ValueError:
pass