algograph-algebraic-portfol.../tests/test_registry.py

21 lines
638 B
Python

import time
from algograph_algebraic_portfolio_compiler_f.registry import GraphOfContractsRegistry
def test_registry_basic_operations():
reg = GraphOfContractsRegistry()
reg.register_contract(
contract_id="idea-1",
name="toyAdapter",
version="0.1.0",
schema={"type": "adapter", "fields": ["price", "volume"]},
signer="tester",
timestamp=time.time(),
)
c = reg.get_contract("idea-1")
assert c is not None
assert c.name == "toyAdapter"
reg.add_attestation("idea-1", "attestation-123")
assert reg.get_contract("idea-1").attestations[-1] == "attestation-123"