summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorHugh Nimmo-Smith <hughns@element.io>2023-09-22 18:01:59 +0100
committerHugh Nimmo-Smith <hughns@element.io>2023-09-22 18:01:59 +0100
commit151b237768a4d54944cd9966aa6c94f05e6b1c12 (patch)
tree9239b7430d6e37dba7a0cb845b2e5efe9272c25c /tests
parentLint (diff)
downloadsynapse-hughns/msc3882-unstable-r1.tar.xz
Diffstat (limited to 'tests')
-rw-r--r--tests/rest/client/test_capabilities.py2
-rw-r--r--tests/rest/client/test_login.py6
-rw-r--r--tests/rest/client/test_login_token_request.py16
3 files changed, 17 insertions, 7 deletions
diff --git a/tests/rest/client/test_capabilities.py b/tests/rest/client/test_capabilities.py
index cf23430f6a..77ab1a8b3d 100644
--- a/tests/rest/client/test_capabilities.py
+++ b/tests/rest/client/test_capabilities.py
@@ -200,6 +200,7 @@ class CapabilitiesTestCase(unittest.HomeserverTestCase):
 
         self.assertEqual(channel.code, HTTPStatus.OK)
         self.assertFalse(capabilities["m.get_login_token"]["enabled"])
+        self.assertFalse(capabilities["org.matrix.msc3882.get_login_token"]["enabled"])
 
     @override_config({"login_via_existing_session": {"enabled": True}})
     def test_get_get_token_login_fields_when_enabled(self) -> None:
@@ -214,3 +215,4 @@ class CapabilitiesTestCase(unittest.HomeserverTestCase):
 
         self.assertEqual(channel.code, HTTPStatus.OK)
         self.assertTrue(capabilities["m.get_login_token"]["enabled"])
+        self.assertTrue(capabilities["org.matrix.msc3882.get_login_token"]["enabled"])
diff --git a/tests/rest/client/test_login.py b/tests/rest/client/test_login.py
index 768d7ad4c2..f1ee67c00e 100644
--- a/tests/rest/client/test_login.py
+++ b/tests/rest/client/test_login.py
@@ -527,7 +527,11 @@ class LoginRestServletTestCase(unittest.HomeserverTestCase):
         self.assertCountEqual(
             channel.json_body["flows"],
             [
-                {"type": "m.login.token", "get_login_token": True},
+                {
+                    "type": "m.login.token",
+                    "get_login_token": True,
+                    "org.matrix.msc3882.get_login_token": True,
+                },
                 {"type": "m.login.password"},
                 {"type": "m.login.application_service"},
             ],
diff --git a/tests/rest/client/test_login_token_request.py b/tests/rest/client/test_login_token_request.py
index ff83e88e3e..aaf8faafea 100644
--- a/tests/rest/client/test_login_token_request.py
+++ b/tests/rest/client/test_login_token_request.py
@@ -15,7 +15,7 @@
 from twisted.test.proto_helpers import MemoryReactor
 
 from synapse.rest import admin
-from synapse.rest.client import login, login_token_request, versions
+from synapse.rest.client import capabilities, login, login_token_request, versions
 from synapse.server import HomeServer
 from synapse.util import Clock
 
@@ -31,6 +31,7 @@ class LoginTokenRequestServletTestCase(unittest.HomeserverTestCase):
         admin.register_servlets,
         login_token_request.register_servlets,
         versions.register_servlets,  # TODO: remove once unstable revision 0 support is removed
+        capabilities.register_servlets,  # TODO: remove once unstable revision 1 support is removed
     ]
 
     def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
@@ -179,18 +180,21 @@ class LoginTokenRequestServletTestCase(unittest.HomeserverTestCase):
     def test_unstable_revision1_support(self) -> None:
         # TODO: remove when unstable MSC3882 is no longer needed
 
+        self.register_user(self.user, self.password)
+        token = self.login(self.user, self.password)
+
         # check feature is advertised in versions response:
         channel = self.make_request(
-            "GET", "/_matrix/client/versions", {}, access_token=None
+            "GET", "/_matrix/client/v3/capabilities", {}, access_token=token
         )
         self.assertEqual(channel.code, 200)
         self.assertEqual(
-            channel.json_body["unstable_features"]["org.matrix.msc3882"], True
+            channel.json_body["capabilities"]["org.matrix.msc3882.get_login_token"][
+                "enabled"
+            ],
+            True,
         )
 
-        self.register_user(self.user, self.password)
-        token = self.login(self.user, self.password)
-
         # check feature is available via the r1 unstable endpoint and returns an expires_in_ms value in milliseconds
         channel = self.make_request(
             "POST",