summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatt C <96466754+buffless-matt@users.noreply.github.com>2022-08-03 19:25:36 +1000
committerGitHub <noreply@github.com>2022-08-03 09:25:36 +0000
commit570bf32bbb9b4bd31a9783746187769613591499 (patch)
treeaab250e9667a795f3a207ac35f1c3c26fbaa3e07 /tests
parentRemove 'Contents' section from the Configuration Manual (#13438) (diff)
downloadsynapse-570bf32bbb9b4bd31a9783746187769613591499.tar.xz
Add module API method to resolve a room alias to a room ID (#13428)
Co-authored-by: MattC <buffless-matt@users.noreply.github.com>
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/module_api/test_api.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/module_api/test_api.py b/tests/module_api/test_api.py
index 169e29b590..8e05590230 100644
--- a/tests/module_api/test_api.py
+++ b/tests/module_api/test_api.py
@@ -635,6 +635,25 @@ class ModuleApiTestCase(HomeserverTestCase):
             [{"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"""