35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
from hopemesh.cli import main
|
|
|
|
|
|
class HopeMeshCLITests(unittest.TestCase):
|
|
def test_registry_and_ledger_commands(self) -> None:
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
store = Path(tmpdir) / "state.json"
|
|
self.assertEqual(main(["registry", "init", "--store", str(store)]), 0)
|
|
self.assertEqual(
|
|
main(
|
|
[
|
|
"registry",
|
|
"add-schema",
|
|
"--store",
|
|
str(store),
|
|
"--name",
|
|
"allocation",
|
|
"--schema-version",
|
|
"1.0",
|
|
"--definition-json",
|
|
'{"fields":["region","qty"]}',
|
|
]
|
|
),
|
|
0,
|
|
)
|
|
self.assertEqual(main(["ledger", "verify", "--store", str(store)]), 0)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|