diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-01-13 07:05:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-13 07:05:16 -0500 |
commit | 98a64b7f7f256b7afd4a1d735cb32d099e44831a (patch) | |
tree | d58c5d8d423a93541d63ace5eb0d0e1be32192d5 /tests | |
parent | Merge branch 'master' into develop (diff) | |
download | synapse-98a64b7f7f256b7afd4a1d735cb32d099e44831a.tar.xz |
Add basic domain validation for `DomainSpecificString.is_valid`. (#9071)
This checks that the domain given to `DomainSpecificString.is_valid` (e.g. `UserID`, `RoomAlias`, etc.) is of a valid form. Previously some validation was done on the localpart (e.g. the sigil), but not the domain portion.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_types.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/test_types.py b/tests/test_types.py index 480bea1bdc..acdeea7a09 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -58,6 +58,10 @@ class RoomAliasTestCase(unittest.HomeserverTestCase): self.assertEquals(room.to_string(), "#channel:my.domain") + def test_validate(self): + id_string = "#test:domain,test" + self.assertFalse(RoomAlias.is_valid(id_string)) + class GroupIDTestCase(unittest.TestCase): def test_parse(self): |