feat: add platform chat id room metadata helpers

This commit is contained in:
Mikhail Putilovskij 2026-04-19 16:50:12 +03:00
parent 9bb93fbbda
commit f3f9b10d6b
2 changed files with 36 additions and 0 deletions

View file

@ -5,12 +5,14 @@ import pytest
from adapter.matrix.store import (
clear_pending_confirm,
get_pending_confirm,
get_platform_chat_id,
get_room_meta,
get_room_state,
get_skills_message_id,
get_user_meta,
next_chat_id,
set_pending_confirm,
set_platform_chat_id,
set_room_meta,
set_room_state,
set_skills_message_id,
@ -35,6 +37,27 @@ async def test_room_meta_roundtrip(store: InMemoryStore):
assert await get_room_meta(store, "!r:m.org") == meta
async def test_room_meta_roundtrip_with_platform_chat_id(store: InMemoryStore):
meta = {
"chat_id": "C1",
"matrix_user_id": "@alice:example.org",
"platform_chat_id": "chat-platform-1",
}
await set_room_meta(store, "!r:m.org", meta)
saved = await get_room_meta(store, "!r:m.org")
assert saved is not None
assert saved["platform_chat_id"] == "chat-platform-1"
async def test_platform_chat_id_helpers_roundtrip(store: InMemoryStore):
await set_platform_chat_id(store, "!r:m.org", "chat-platform-1")
assert await get_platform_chat_id(store, "!r:m.org") == "chat-platform-1"
assert await get_room_meta(store, "!r:m.org") == {
"platform_chat_id": "chat-platform-1"
}
async def test_room_meta_missing(store: InMemoryStore):
assert await get_room_meta(store, "!nonexistent:m.org") is None