summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2015-01-28 16:45:18 +0000
committerKegan Dougal <kegan@matrix.org>2015-01-28 16:45:18 +0000
commitc23e3db544eb940d95a092b661e3872480f3bf30 (patch)
treeddb9952d637e87ad9e6ce357c113d9fc0b9a2654 /tests
parentCreated schema delta (diff)
downloadsynapse-c23e3db544eb940d95a092b661e3872480f3bf30.tar.xz
Add filter JSON sanity checks.
Diffstat (limited to 'tests')
-rw-r--r--tests/api/test_filtering.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/api/test_filtering.py b/tests/api/test_filtering.py
index 149948374d..188fbfb91e 100644
--- a/tests/api/test_filtering.py
+++ b/tests/api/test_filtering.py
@@ -57,13 +57,21 @@ class FilteringTestCase(unittest.TestCase):
 
     @defer.inlineCallbacks
     def test_add_filter(self):
+        user_filter = {
+            "room": {
+                "state": {
+                    "types": ["m.*"]
+                }
+            }
+        }
+
         filter_id = yield self.filtering.add_user_filter(
             user_localpart=user_localpart,
-            definition={"type": ["m.*"]},
+            user_filter=user_filter,
         )
 
         self.assertEquals(filter_id, 0)
-        self.assertEquals({"type": ["m.*"]},
+        self.assertEquals(user_filter,
             (yield self.datastore.get_user_filter(
                 user_localpart=user_localpart,
                 filter_id=0,
@@ -72,9 +80,17 @@ class FilteringTestCase(unittest.TestCase):
 
     @defer.inlineCallbacks
     def test_get_filter(self):
+        user_filter = {
+            "room": {
+                "state": {
+                    "types": ["m.*"]
+                }
+            }
+        }
+
         filter_id = yield self.datastore.add_user_filter(
             user_localpart=user_localpart,
-            definition={"type": ["m.*"]},
+            user_filter=user_filter,
         )
 
         filter = yield self.filtering.get_user_filter(
@@ -82,4 +98,4 @@ class FilteringTestCase(unittest.TestCase):
             filter_id=filter_id,
         )
 
-        self.assertEquals(filter, {"type": ["m.*"]})
+        self.assertEquals(filter, user_filter)