Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 83de48b

Browse files
committed
Add - unit test for the module API "lookup_room_alias" method.
1 parent be9a783 commit 83de48b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/module_api/test_api.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,25 @@ def test_check_push_rules_actions(self) -> None:
635635
[{"set_tweak": "sound", "value": "default"}]
636636
)
637637

638+
def test_lookup_room_alias(self) -> None:
639+
"""Test that modules can resolve a room alias to a room ID."""
640+
password = "password"
641+
user_id = self.register_user("user", password)
642+
access_token = self.login(user_id, password)
643+
room_alias = "my-alias"
644+
reference_room_id = self.helper.create_room_as(
645+
tok=access_token, extra_content={"room_alias_name": room_alias}
646+
)
647+
self.assertIsNotNone(reference_room_id)
648+
649+
(room_id, _) = self.get_success(
650+
self.module_api.lookup_room_alias(
651+
f"#{room_alias}:{self.module_api.server_name}"
652+
)
653+
)
654+
655+
self.assertEqual(room_id, reference_room_id)
656+
638657

639658
class ModuleApiWorkerTestCase(BaseMultiWorkerStreamTestCase):
640659
"""For testing ModuleApi functionality in a multi-worker setup"""

0 commit comments

Comments
 (0)