summary refs log tree commit diff
path: root/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'tests/api')
-rw-r--r--tests/api/test_filtering.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/api/test_filtering.py b/tests/api/test_filtering.py
index 50e8607c14..ce4116ff56 100644
--- a/tests/api/test_filtering.py
+++ b/tests/api/test_filtering.py
@@ -23,6 +23,7 @@ from tests.utils import (
 
 from synapse.api.filtering import Filter
 from synapse.events import FrozenEvent
+from synapse.api.errors import SynapseError
 
 user_localpart = "test_user"
 
@@ -34,7 +35,6 @@ def MockEvent(**kwargs):
         kwargs["type"] = "fake_type"
     return FrozenEvent(kwargs)
 
-
 class FilteringTestCase(unittest.TestCase):
 
     @defer.inlineCallbacks
@@ -54,6 +54,22 @@ class FilteringTestCase(unittest.TestCase):
 
         self.datastore = hs.get_datastore()
 
+    def test_errors_on_invalid_filters(self):
+        invalid_filters = [
+            { "boom": {} },
+            { "account_data": "Hello World" },
+            { "event_fields": ["\\foo"] },
+            { "room": { "timeline" : { "limit" : 0 }, "state": { "not_bars": ["*"]} } },
+        ]
+        for filter in invalid_filters:
+            with self.assertRaises(SynapseError) as check_filter_error:
+                self.filtering.check_valid_filter(filter)
+                self.assertIsInstance(check_filter_error.exception, SynapseError)
+
+    def test_limits_are_applied(self):
+        #TODO
+        pass
+
     def test_definition_types_works_with_literals(self):
         definition = {
             "types": ["m.room.message", "org.matrix.foo.bar"]