summary refs log tree commit diff
path: root/tests/push
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2022-02-28 17:40:24 +0000
committerGitHub <noreply@github.com>2022-02-28 17:40:24 +0000
commit6c0b44a3d73f73dc5913f081418347645dc84d6f (patch)
treec5f902578af302b30d2be221fea51c49731f5b32 /tests/push
parentActually fix bad debug logging rejecting device list & signing key transactio... (diff)
downloadsynapse-6c0b44a3d73f73dc5913f081418347645dc84d6f.tar.xz
Fix `PushRuleEvaluator` and `Filter` to work on frozendicts (#12100)
* Fix `PushRuleEvaluator` to work on frozendicts

frozendicts do not (necessarily) inherit from dict, so this needs to handle
them correctly.

* Fix event filtering for frozen events

Looks like this one was introduced by #11194.
Diffstat (limited to 'tests/push')
-rw-r--r--tests/push/test_push_rule_evaluator.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/push/test_push_rule_evaluator.py b/tests/push/test_push_rule_evaluator.py
index a52e89e407..3849beb9d6 100644
--- a/tests/push/test_push_rule_evaluator.py
+++ b/tests/push/test_push_rule_evaluator.py
@@ -14,6 +14,8 @@
 
 from typing import Any, Dict
 
+import frozendict
+
 from synapse.api.room_versions import RoomVersions
 from synapse.events import FrozenEvent
 from synapse.push import push_rule_evaluator
@@ -191,6 +193,13 @@ class PushRuleEvaluatorTestCase(unittest.TestCase):
             "pattern should only match at the start/end of the value",
         )
 
+        # it should work on frozendicts too
+        self._assert_matches(
+            condition,
+            frozendict.frozendict({"value": "FoobaZ"}),
+            "patterns should match on frozendicts",
+        )
+
         # wildcards should match
         condition = {
             "kind": "event_match",