mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-25 05:25:18 -04:00
MSC3244 room capabilities implementation (#10283)
This commit is contained in:
parent
794371b1bf
commit
69226c1ab4
5 changed files with 93 additions and 3 deletions
|
@ -102,3 +102,49 @@ class CapabilitiesTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
self.assertEqual(channel.code, 200)
|
||||
self.assertFalse(capabilities["m.change_password"]["enabled"])
|
||||
|
||||
def test_get_does_not_include_msc3244_fields_by_default(self):
|
||||
localpart = "user"
|
||||
password = "pass"
|
||||
user = self.register_user(localpart, password)
|
||||
access_token = self.get_success(
|
||||
self.auth_handler.get_access_token_for_user_id(
|
||||
user, device_id=None, valid_until_ms=None
|
||||
)
|
||||
)
|
||||
|
||||
channel = self.make_request("GET", self.url, access_token=access_token)
|
||||
capabilities = channel.json_body["capabilities"]
|
||||
|
||||
self.assertEqual(channel.code, 200)
|
||||
self.assertNotIn(
|
||||
"org.matrix.msc3244.room_capabilities", capabilities["m.room_versions"]
|
||||
)
|
||||
|
||||
@override_config({"experimental_features": {"msc3244_enabled": True}})
|
||||
def test_get_does_include_msc3244_fields_when_enabled(self):
|
||||
localpart = "user"
|
||||
password = "pass"
|
||||
user = self.register_user(localpart, password)
|
||||
access_token = self.get_success(
|
||||
self.auth_handler.get_access_token_for_user_id(
|
||||
user, device_id=None, valid_until_ms=None
|
||||
)
|
||||
)
|
||||
|
||||
channel = self.make_request("GET", self.url, access_token=access_token)
|
||||
capabilities = channel.json_body["capabilities"]
|
||||
|
||||
self.assertEqual(channel.code, 200)
|
||||
for details in capabilities["m.room_versions"][
|
||||
"org.matrix.msc3244.room_capabilities"
|
||||
].values():
|
||||
if details["preferred"] is not None:
|
||||
self.assertTrue(
|
||||
details["preferred"] in KNOWN_ROOM_VERSIONS,
|
||||
str(details["preferred"]),
|
||||
)
|
||||
|
||||
self.assertGreater(len(details["support"]), 0)
|
||||
for room_version in details["support"]:
|
||||
self.assertTrue(room_version in KNOWN_ROOM_VERSIONS, str(room_version))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue