feat(matrix): create real rooms for new chats
This commit is contained in:
parent
82eb711844
commit
14c091b5f5
4 changed files with 89 additions and 8 deletions
|
|
@ -49,6 +49,28 @@ async def test_matrix_dispatcher_registers_custom_handlers():
|
|||
assert any(isinstance(r, OutgoingMessage) and "fetch-url" in r.text for r in result)
|
||||
|
||||
|
||||
async def test_new_chat_creates_real_matrix_room_when_client_available():
|
||||
client = SimpleNamespace(room_create=AsyncMock(return_value=SimpleNamespace(room_id="!r2:example")))
|
||||
runtime = build_runtime(platform=MockPlatformClient(), client=client)
|
||||
|
||||
start = IncomingCommand(user_id="u1", platform="matrix", chat_id="C1", command="start")
|
||||
await runtime.dispatcher.dispatch(start)
|
||||
|
||||
new = IncomingCommand(
|
||||
user_id="u1",
|
||||
platform="matrix",
|
||||
chat_id="C1",
|
||||
command="new",
|
||||
args=["Research"],
|
||||
)
|
||||
result = await runtime.dispatcher.dispatch(new)
|
||||
|
||||
client.room_create.assert_awaited_once_with(name="Research", invite=["u1"], is_direct=False)
|
||||
chats = await runtime.chat_mgr.list_active("u1")
|
||||
assert [c.surface_ref for c in chats] == ["!r2:example"]
|
||||
assert any(isinstance(r, OutgoingMessage) and "!r2:example" in r.text for r in result)
|
||||
|
||||
|
||||
async def test_invite_event_creates_dm_room_and_sends_welcome():
|
||||
runtime = build_runtime(platform=MockPlatformClient())
|
||||
client = SimpleNamespace(join=AsyncMock(), room_send=AsyncMock())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue