diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2015-01-27 18:46:03 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2015-01-27 18:46:03 +0000 |
commit | 06cc1470129d443f71bfc81ba716f63b9505467d (patch) | |
tree | 48a551ad093909d2544ed1459900ab74c6148d75 /tests | |
parent | More unit-testing of REST errors (diff) | |
download | synapse-06cc1470129d443f71bfc81ba716f63b9505467d.tar.xz |
Initial stab at real SQL storage implementation of user filter definitions
Diffstat (limited to 'tests')
-rw-r--r-- | tests/api/test_filtering.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/api/test_filtering.py b/tests/api/test_filtering.py index fecadd1056..149948374d 100644 --- a/tests/api/test_filtering.py +++ b/tests/api/test_filtering.py @@ -53,16 +53,33 @@ class FilteringTestCase(unittest.TestCase): self.filtering = hs.get_filtering() + self.datastore = hs.get_datastore() + @defer.inlineCallbacks - def test_filter(self): + def test_add_filter(self): filter_id = yield self.filtering.add_user_filter( user_localpart=user_localpart, definition={"type": ["m.*"]}, ) + self.assertEquals(filter_id, 0) + self.assertEquals({"type": ["m.*"]}, + (yield self.datastore.get_user_filter( + user_localpart=user_localpart, + filter_id=0, + )) + ) + + @defer.inlineCallbacks + def test_get_filter(self): + filter_id = yield self.datastore.add_user_filter( + user_localpart=user_localpart, + definition={"type": ["m.*"]}, + ) filter = yield self.filtering.get_user_filter( user_localpart=user_localpart, filter_id=filter_id, ) + self.assertEquals(filter, {"type": ["m.*"]}) |