summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-01-13 07:05:16 -0500
committerGitHub <noreply@github.com>2021-01-13 07:05:16 -0500
commit98a64b7f7f256b7afd4a1d735cb32d099e44831a (patch)
treed58c5d8d423a93541d63ace5eb0d0e1be32192d5 /tests
parentMerge branch 'master' into develop (diff)
downloadsynapse-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 '')
-rw-r--r--tests/test_types.py4
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):