summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-03-18 14:23:46 +0000
committerErik Johnston <erik@matrix.org>2019-03-18 15:51:00 +0000
commite64f7c0188e28a8486bd7f68ed0d48e9838234d5 (patch)
tree0310b579c8aa9924e962de99cd73a87063886633
parentAdd user_may_join_room spam check (diff)
downloadsynapse-e64f7c0188e28a8486bd7f68ed0d48e9838234d5.tar.xz
Run black on tests/rulecheck/test_domainrulecheck.py
-rw-r--r--tests/rulecheck/test_domainrulecheck.py68
1 files changed, 38 insertions, 30 deletions
diff --git a/tests/rulecheck/test_domainrulecheck.py b/tests/rulecheck/test_domainrulecheck.py
index 702862f78b..ebcf5ca44e 100644
--- a/tests/rulecheck/test_domainrulecheck.py
+++ b/tests/rulecheck/test_domainrulecheck.py
@@ -21,22 +21,24 @@ from tests import unittest
 
 
 class DomainRuleCheckerTestCase(unittest.TestCase):
-
     def test_allowed(self):
         config = {
             "default": False,
             "domain_mapping": {
                 "source_one": ["target_one", "target_two"],
-                "source_two": ["target_two"]
-            }
+                "source_two": ["target_two"],
+            },
         }
         check = DomainRuleChecker(config)
-        self.assertTrue(check.user_may_invite("test:source_one",
-                                              "test:target_one", "room"))
-        self.assertTrue(check.user_may_invite("test:source_one",
-                                              "test:target_two", "room"))
-        self.assertTrue(check.user_may_invite("test:source_two",
-                                              "test:target_two", "room"))
+        self.assertTrue(
+            check.user_may_invite("test:source_one", "test:target_one", "room")
+        )
+        self.assertTrue(
+            check.user_may_invite("test:source_one", "test:target_two", "room")
+        )
+        self.assertTrue(
+            check.user_may_invite("test:source_two", "test:target_two", "room")
+        )
 
     def test_disallowed(self):
         config = {
@@ -44,50 +46,56 @@ class DomainRuleCheckerTestCase(unittest.TestCase):
             "domain_mapping": {
                 "source_one": ["target_one", "target_two"],
                 "source_two": ["target_two"],
-                "source_four": []
-            }
+                "source_four": [],
+            },
         }
         check = DomainRuleChecker(config)
-        self.assertFalse(check.user_may_invite("test:source_one",
-                                               "test:target_three", "room"))
-        self.assertFalse(check.user_may_invite("test:source_two",
-                                               "test:target_three", "room"))
-        self.assertFalse(check.user_may_invite("test:source_two",
-                                               "test:target_one", "room"))
-        self.assertFalse(check.user_may_invite("test:source_four",
-                                               "test:target_one", "room"))
+        self.assertFalse(
+            check.user_may_invite("test:source_one", "test:target_three", "room")
+        )
+        self.assertFalse(
+            check.user_may_invite("test:source_two", "test:target_three", "room")
+        )
+        self.assertFalse(
+            check.user_may_invite("test:source_two", "test:target_one", "room")
+        )
+        self.assertFalse(
+            check.user_may_invite("test:source_four", "test:target_one", "room")
+        )
 
     def test_default_allow(self):
         config = {
             "default": True,
             "domain_mapping": {
                 "source_one": ["target_one", "target_two"],
-                "source_two": ["target_two"]
-            }
+                "source_two": ["target_two"],
+            },
         }
         check = DomainRuleChecker(config)
-        self.assertTrue(check.user_may_invite("test:source_three",
-                                              "test:target_one", "room"))
+        self.assertTrue(
+            check.user_may_invite("test:source_three", "test:target_one", "room")
+        )
 
     def test_default_deny(self):
         config = {
             "default": False,
             "domain_mapping": {
                 "source_one": ["target_one", "target_two"],
-                "source_two": ["target_two"]
-            }
+                "source_two": ["target_two"],
+            },
         }
         check = DomainRuleChecker(config)
-        self.assertFalse(check.user_may_invite("test:source_three",
-                                               "test:target_one", "room"))
+        self.assertFalse(
+            check.user_may_invite("test:source_three", "test:target_one", "room")
+        )
 
     def test_config_parse(self):
         config = {
             "default": False,
             "domain_mapping": {
                 "source_one": ["target_one", "target_two"],
-                "source_two": ["target_two"]
-            }
+                "source_two": ["target_two"],
+            },
         }
         self.assertEquals(config, DomainRuleChecker.parse_config(config))
 
@@ -95,7 +103,7 @@ class DomainRuleCheckerTestCase(unittest.TestCase):
         config = {
             "domain_mapping": {
                 "source_one": ["target_one", "target_two"],
-                "source_two": ["target_two"]
+                "source_two": ["target_two"],
             }
         }
         self.assertRaises(ConfigError, DomainRuleChecker.parse_config, config)