mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-28 00:42:10 -04:00
Initial stab at real SQL storage implementation of user filter definitions
This commit is contained in:
parent
0c14a699bb
commit
06cc147012
4 changed files with 78 additions and 15 deletions
|
@ -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.*"]})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue