summary refs log tree commit diff
path: root/tests/federation/test_federation_server.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2021-05-11 14:15:30 +0100
committerBrendan Abolivier <babolivier@matrix.org>2021-05-11 14:15:30 +0100
commit652a6b094d98e56290f0b6889cc401c364bad433 (patch)
treeba7a21ef2804be8fa33bf1463ecbfb0743090f06 /tests/federation/test_federation_server.py
parentAdd config option to hide device names over federation (#9945) (diff)
parentUse link to advisory rather than to the CVE repo (diff)
downloadsynapse-652a6b094d98e56290f0b6889cc401c364bad433.tar.xz
Merge branch 'master' into develop
Diffstat (limited to 'tests/federation/test_federation_server.py')
-rw-r--r--tests/federation/test_federation_server.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/federation/test_federation_server.py b/tests/federation/test_federation_server.py
index 8508b6bd3b..1737891564 100644
--- a/tests/federation/test_federation_server.py
+++ b/tests/federation/test_federation_server.py
@@ -74,6 +74,25 @@ class ServerACLsTestCase(unittest.TestCase):
         self.assertFalse(server_matches_acl_event("[1:2::]", e))
         self.assertTrue(server_matches_acl_event("1:2:3:4", e))
 
+    def test_wildcard_matching(self):
+        e = _create_acl_event({"allow": ["good*.com"]})
+        self.assertTrue(
+            server_matches_acl_event("good.com", e),
+            "* matches 0 characters",
+        )
+        self.assertTrue(
+            server_matches_acl_event("GOOD.COM", e),
+            "pattern is case-insensitive",
+        )
+        self.assertTrue(
+            server_matches_acl_event("good.aa.com", e),
+            "* matches several characters, including '.'",
+        )
+        self.assertFalse(
+            server_matches_acl_event("ishgood.com", e),
+            "pattern does not allow prefixes",
+        )
+
 
 class StateQueryTests(unittest.FederatingHomeserverTestCase):