Add timestamp tracking to dummy relay and update tests

This commit is contained in:
thePR0M3TH3AN
2025-07-14 08:55:55 -04:00
parent 2a329a40bb
commit e45483c6eb
5 changed files with 14 additions and 6 deletions

View File

@@ -29,7 +29,7 @@ def _init_pm(dir_path: Path, client) -> PasswordManager:
return pm
def test_full_sync_roundtrip(dummy_nostr_client, monkeypatch):
def test_full_sync_roundtrip(dummy_nostr_client):
client, relay = dummy_nostr_client
with TemporaryDirectory() as tmpdir:
base = Path(tmpdir)
@@ -54,9 +54,9 @@ def test_full_sync_roundtrip(dummy_nostr_client, monkeypatch):
# Manager A publishes delta with second entry
pm_a.entry_manager.add_entry("site2", 12)
delta_bytes = pm_a.vault.get_encrypted_index() or b""
# Use a constant timestamp so dummy relay returns the delta
monkeypatch.setattr("nostr.client.time.time", lambda: 1)
asyncio.run(client.publish_delta(delta_bytes, manifest_id))
delta_ts = relay.deltas[-1].created_at
assert relay.manifests[-1].delta_since == delta_ts
# Manager B fetches delta and updates
pm_b.sync_index_from_nostr()