feat: finalize matrix platform audit and docs
This commit is contained in:
parent
6422c7db58
commit
4524a6abc8
30 changed files with 3093 additions and 176 deletions
|
|
@ -272,10 +272,7 @@ async def test_bot_assigns_platform_chat_id_for_existing_managed_room():
|
|||
|
||||
await bot.on_room_message(room, event)
|
||||
|
||||
assert (
|
||||
await get_platform_chat_id(runtime.store, "!chat1:example.org")
|
||||
== "matrix:!chat1:example.org"
|
||||
)
|
||||
assert await get_platform_chat_id(runtime.store, "!chat1:example.org") == "1"
|
||||
runtime.dispatcher.dispatch.assert_awaited_once()
|
||||
|
||||
|
||||
|
|
@ -287,7 +284,7 @@ async def test_bot_routes_plain_messages_via_platform_chat_id():
|
|||
{
|
||||
"chat_id": "C1",
|
||||
"matrix_user_id": "@alice:example.org",
|
||||
"platform_chat_id": "matrix:ctx-1",
|
||||
"platform_chat_id": "41",
|
||||
},
|
||||
)
|
||||
client = SimpleNamespace(user_id="@bot:example.org")
|
||||
|
|
@ -300,7 +297,7 @@ async def test_bot_routes_plain_messages_via_platform_chat_id():
|
|||
await bot.on_room_message(room, event)
|
||||
|
||||
dispatched = runtime.dispatcher.dispatch.await_args.args[0]
|
||||
assert dispatched.chat_id == "matrix:ctx-1"
|
||||
assert dispatched.chat_id == "41"
|
||||
assert dispatched.text == "hello"
|
||||
|
||||
|
||||
|
|
@ -313,7 +310,7 @@ async def test_bot_downloads_matrix_file_to_workspace_before_staging(tmp_path, m
|
|||
{
|
||||
"chat_id": "C1",
|
||||
"matrix_user_id": "@alice:example.org",
|
||||
"platform_chat_id": "matrix:ctx-1",
|
||||
"platform_chat_id": "41",
|
||||
},
|
||||
)
|
||||
client = SimpleNamespace(
|
||||
|
|
@ -539,7 +536,7 @@ async def test_next_normal_message_commits_staged_attachments():
|
|||
{
|
||||
"chat_id": "C1",
|
||||
"matrix_user_id": "@alice:example.org",
|
||||
"platform_chat_id": "matrix:ctx-1",
|
||||
"platform_chat_id": "41",
|
||||
},
|
||||
)
|
||||
await add_staged_attachment(
|
||||
|
|
@ -584,7 +581,7 @@ async def test_failed_commit_preserves_staged_attachments():
|
|||
{
|
||||
"chat_id": "C1",
|
||||
"matrix_user_id": "@alice:example.org",
|
||||
"platform_chat_id": "matrix:ctx-1",
|
||||
"platform_chat_id": "41",
|
||||
},
|
||||
)
|
||||
await add_staged_attachment(
|
||||
|
|
@ -622,7 +619,7 @@ async def test_bot_keeps_commands_on_local_chat_id():
|
|||
{
|
||||
"chat_id": "C1",
|
||||
"matrix_user_id": "@alice:example.org",
|
||||
"platform_chat_id": "matrix:ctx-1",
|
||||
"platform_chat_id": "41",
|
||||
},
|
||||
)
|
||||
client = SimpleNamespace(user_id="@bot:example.org")
|
||||
|
|
@ -647,7 +644,7 @@ async def test_bot_leaves_existing_platform_chat_id_unchanged():
|
|||
{
|
||||
"chat_id": "C1",
|
||||
"matrix_user_id": "@alice:example.org",
|
||||
"platform_chat_id": "matrix:existing",
|
||||
"platform_chat_id": "99",
|
||||
},
|
||||
)
|
||||
client = SimpleNamespace(user_id="@bot:example.org")
|
||||
|
|
@ -659,7 +656,7 @@ async def test_bot_leaves_existing_platform_chat_id_unchanged():
|
|||
|
||||
await bot.on_room_message(room, event)
|
||||
|
||||
assert await get_platform_chat_id(runtime.store, "!chat1:example.org") == "matrix:existing"
|
||||
assert await get_platform_chat_id(runtime.store, "!chat1:example.org") == "99"
|
||||
runtime.dispatcher.dispatch.assert_awaited_once()
|
||||
|
||||
|
||||
|
|
@ -686,10 +683,7 @@ async def test_bot_assigns_platform_chat_id_before_load_selection():
|
|||
|
||||
await bot.on_room_message(room, event)
|
||||
|
||||
assert (
|
||||
await get_platform_chat_id(runtime.store, "!chat1:example.org")
|
||||
== "matrix:!chat1:example.org"
|
||||
)
|
||||
assert await get_platform_chat_id(runtime.store, "!chat1:example.org") == "1"
|
||||
client.room_send.assert_awaited_once_with(
|
||||
"!chat1:example.org",
|
||||
"m.room.message",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue