diff options
author | Kegan Dougal <kegan@matrix.org> | 2015-01-28 16:45:18 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2015-01-28 16:45:18 +0000 |
commit | c23e3db544eb940d95a092b661e3872480f3bf30 (patch) | |
tree | ddb9952d637e87ad9e6ce357c113d9fc0b9a2654 /tests | |
parent | Created schema delta (diff) | |
download | synapse-c23e3db544eb940d95a092b661e3872480f3bf30.tar.xz |
Add filter JSON sanity checks.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/api/test_filtering.py | 24 |
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) |