From 71302b9eeb9bd13e66d82b7a40bbe755cd8ca26d Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Wed, 4 Dec 2024 11:06:01 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> --- synapse/config/appservice.py | 2 +- tests/handlers/test_appservice.py | 6 ++++-- tests/rest/client/test_devices.py | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/synapse/config/appservice.py b/synapse/config/appservice.py index 8a38229dd23..dda6bcd1b79 100644 --- a/synapse/config/appservice.py +++ b/synapse/config/appservice.py @@ -184,7 +184,7 @@ def _load_appservice( ) # Opt-in flag for the MSC4190 behaviours. - # When enabled, the following C-S API endpoints change: + # When enabled, the following C-S API endpoints change for appservices: # - POST /register does not return an access token # - PUT /devices/{device_id} creates a new device if one does not exist # - DELETE /devices/{device_id} no longer requires UIA diff --git a/tests/handlers/test_appservice.py b/tests/handlers/test_appservice.py index f491639ca23..1db630e9e47 100644 --- a/tests/handlers/test_appservice.py +++ b/tests/handlers/test_appservice.py @@ -1168,8 +1168,10 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None: user_id, device_id = self.register_appservice_user( "as.sender", self._service_token ) - # With MSC4190 enabled, we may not have a device out of the - # registration, but we don't have it enabled in this test + # With MSC4190 enabled, there will not be a device created + # during AS registration. However MSC4190 is not enabled + # in this test. It may become the default behaviour in the + # future, in which case this test will need to be updated. assert device_id is not None self._sender_user = user_id self._sender_device = device_id diff --git a/tests/rest/client/test_devices.py b/tests/rest/client/test_devices.py index f910bc05c76..455ec6a5e38 100644 --- a/tests/rest/client/test_devices.py +++ b/tests/rest/client/test_devices.py @@ -529,7 +529,8 @@ def test_PUT_device(self) -> None: ) self.assertEqual(channel.code, 200, channel.json_body) - # On the regular service, that API sh + # On the regular service, that API should not allow for the + # creation of new devices. channel = self.make_request( "PUT", "/_matrix/client/v3/devices/AABBCCDD?user_id=@bob:test", @@ -568,7 +569,7 @@ def test_DELETE_device(self) -> None: self.assertEqual(channel.code, 200, channel.json_body) self.assertEqual(len(channel.json_body["devices"]), 1) - # Delete the device + # Delete the device. UIA should not be required. channel = self.make_request( "DELETE", "/_matrix/client/v3/devices/AABBCCDD?user_id=@alice:test", @@ -616,6 +617,7 @@ def test_POST_delete_devices(self) -> None: self.assertEqual(len(channel.json_body["devices"]), 1) # Delete the device with delete_devices + # UIA should not be required. channel = self.make_request( "POST", "/_matrix/client/v3/delete_devices?user_id=@alice:test",