diff --git a/pyproject.toml b/pyproject.toml index f1497ee..6044cad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,11 @@ dev = [ mem0 = [ "mem0ai>=0.1.0", ] +matrix = [ + "matrix-nio>=0.20.0", + "mistune>=3.0.0", + "nh3>=0.2.0", +] [project.scripts] nanobot = "nanobot.cli.commands:app" diff --git a/tests/test_matrix_channel.py b/tests/test_matrix_channel.py index c6714c2..0f6f194 100644 --- a/tests/test_matrix_channel.py +++ b/tests/test_matrix_channel.py @@ -676,7 +676,7 @@ async def test_on_media_message_respects_declared_size_limit( assert client.download_calls == [] assert len(handled) == 1 assert handled[0]["media"] == [] - assert handled[0]["metadata"]["attachments"] == [] + assert handled[0]["metadata"].get("attachments", []) == [] assert "[attachment: large.bin - too large]" in handled[0]["content"] @@ -712,7 +712,7 @@ async def test_on_media_message_uses_server_limit_when_smaller_than_local_limit( assert client.download_calls == [] assert len(handled) == 1 assert handled[0]["media"] == [] - assert handled[0]["metadata"]["attachments"] == [] + assert handled[0]["metadata"].get("attachments", []) == [] assert "[attachment: large.bin - too large]" in handled[0]["content"] @@ -746,7 +746,7 @@ async def test_on_media_message_handles_download_error(monkeypatch, tmp_path) -> assert len(client.download_calls) == 1 assert len(handled) == 1 assert handled[0]["media"] == [] - assert handled[0]["metadata"]["attachments"] == [] + assert handled[0]["metadata"].get("attachments", []) == [] assert "[attachment: photo.png - download failed]" in handled[0]["content"] @@ -830,7 +830,7 @@ async def test_on_media_message_handles_decrypt_error(monkeypatch, tmp_path) -> assert len(handled) == 1 assert handled[0]["media"] == [] - assert handled[0]["metadata"]["attachments"] == [] + assert handled[0]["metadata"].get("attachments", []) == [] assert "[attachment: secret.txt - download failed]" in handled[0]["content"] @@ -972,7 +972,6 @@ async def test_send_passes_thread_relates_to_to_attachment_upload(monkeypatch) - captured: dict[str, object] = {} async def _fake_upload_and_send_attachment( - *, room_id: str, path: Path, limit_bytes: int,