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

Commit

Permalink
Add - unit test for the module API "lookup_room_alias" method.
Browse files Browse the repository at this point in the history
  • Loading branch information
buffless-matt committed Aug 2, 2022
1 parent be9a783 commit 83de48b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/module_api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,25 @@ def test_check_push_rules_actions(self) -> None:
[{"set_tweak": "sound", "value": "default"}]
)

def test_lookup_room_alias(self) -> None:
"""Test that modules can resolve a room alias to a room ID."""
password = "password"
user_id = self.register_user("user", password)
access_token = self.login(user_id, password)
room_alias = "my-alias"
reference_room_id = self.helper.create_room_as(
tok=access_token, extra_content={"room_alias_name": room_alias}
)
self.assertIsNotNone(reference_room_id)

(room_id, _) = self.get_success(
self.module_api.lookup_room_alias(
f"#{room_alias}:{self.module_api.server_name}"
)
)

self.assertEqual(room_id, reference_room_id)


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

0 comments on commit 83de48b

Please sign in to comment.