mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-11 05:23:52 -05:00
Create function to check for long names in devices (#8364)
* Create a new function to verify that the length of a device name is under a certain threshold. * Refactor old code and tests to use said function. * Verify device name length during registration of device * Add a test for the above Signed-off-by: Dionysis Grigoropoulos <dgrig@erethon.com>
This commit is contained in:
parent
4f3096d866
commit
37ca5924bd
4 changed files with 38 additions and 7 deletions
|
|
@ -35,6 +35,17 @@ class DeviceTestCase(unittest.HomeserverTestCase):
|
|||
# These tests assume that it starts 1000 seconds in.
|
||||
self.reactor.advance(1000)
|
||||
|
||||
def test_device_is_created_with_invalid_name(self):
|
||||
self.get_failure(
|
||||
self.handler.check_device_registered(
|
||||
user_id="@boris:foo",
|
||||
device_id="foo",
|
||||
initial_device_display_name="a"
|
||||
* (synapse.handlers.device.MAX_DEVICE_DISPLAY_NAME_LEN + 1),
|
||||
),
|
||||
synapse.api.errors.SynapseError,
|
||||
)
|
||||
|
||||
def test_device_is_created_if_doesnt_exist(self):
|
||||
res = self.get_success(
|
||||
self.handler.check_device_registered(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue