diff options
Diffstat (limited to 'packages/meshbay-node/tests/test_daemon.py')
| -rw-r--r-- | packages/meshbay-node/tests/test_daemon.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/packages/meshbay-node/tests/test_daemon.py b/packages/meshbay-node/tests/test_daemon.py index 71aae78..8bd169d 100644 --- a/packages/meshbay-node/tests/test_daemon.py +++ b/packages/meshbay-node/tests/test_daemon.py @@ -17,6 +17,7 @@ from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey from unittest.mock import AsyncMock, MagicMock, patch from meshbay_common.crypto import generate_gek +from meshbay_common.groupbox import PURPOSE_INDEX, unseal from meshbay_node.config import Config, HubConfig, NodeConfig, GroupConfig, KeystoreConfig from conftest import one_root from meshbay_node.daemon import NodeDaemon @@ -263,7 +264,8 @@ async def test_daemon_index_change_pushes_to_peers(tmp_path, shared_dir, gek, hu msg = mock_session._send.call_args[0][0] assert msg["type"] == "index_sync" assert msg["group_id"] == "a" * 32 - assert len(msg["entries"]) == indexer.index.count + payload = unseal(gek, PURPOSE_INDEX, "index_sync", "a" * 32, msg) + assert len(payload["entries"]) == indexer.index.count # Finding H7: this group is private, so its content hashes must NOT be # registered with the hub. The test previously asserted the opposite — @@ -391,7 +393,9 @@ async def test_first_broadcast_is_full_sync_second_is_delta(tmp_path, shared_dir await asyncio.sleep(0.05) first = session._send.call_args_list[0].args[0] assert first["type"] == "index_sync" - assert len(first["entries"]) == indexer.index.count + # Sealed since MNP 1.0 — the entries are inside, not on the envelope. + first_payload = unseal(gek, PURPOSE_INDEX, "index_sync", "a" * 32, first) + assert len(first_payload["entries"]) == indexer.index.count # Nothing actually changed in the index between the two calls, but # _on_index_change does not know or care why it was called — the @@ -401,8 +405,9 @@ async def test_first_broadcast_is_full_sync_second_is_delta(tmp_path, shared_dir await asyncio.sleep(0.05) second = session._send.call_args_list[1].args[0] assert second["type"] == "index_delta" - assert second["additions"] == [] - assert second["deletions"] == [] + second_payload = unseal(gek, PURPOSE_INDEX, "index_delta", "a" * 32, second) + assert second_payload["additions"] == [] + assert second_payload["deletions"] == [] @pytest.mark.asyncio @@ -435,8 +440,9 @@ async def test_delta_reflects_additions_and_deletions(tmp_path, shared_dir, gek) delta_msg = session._send.call_args_list[1].args[0] assert delta_msg["type"] == "index_delta" - assert delta_msg["deletions"] == [removed_id] - assert [a["id"] for a in delta_msg["additions"]] == ["new-file-id"] + payload = unseal(gek, PURPOSE_INDEX, "index_delta", "a" * 32, delta_msg) + assert payload["deletions"] == [removed_id] + assert [a["id"] for a in payload["additions"]] == ["new-file-id"] @pytest.mark.asyncio |