from datetime import datetime from idea151_aidmesh_federated_privacy.core import DeltaSyncEngine def test_delta_sync_engine_basic(): engine = DeltaSyncEngine(contract_id="c-42") delta1 = {"action": "allocate", "lp": "lp-1", "amount": 10} d1 = engine.create_delta(delta1, author="org-a") assert d1.contract_id == "c-42" # replay from 0 should include delta1 replay = engine.replay_from(0) assert len(replay) == 1 assert replay[0].delta["action"] == "allocate" delta2 = {"action": "route", "lp": "lp-2", "distance": 20} d2 = engine.create_delta(delta2, author="org-b") assert engine.log[-1].author == "org-b" assert len(engine.log) == 2