summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2020-10-13 18:53:56 +0100
committerRichard van der Hoff <richard@matrix.org>2020-10-13 23:24:50 +0100
commit617e8a46538af56bd5abbb2c9e4df8025841c338 (patch)
tree80335f25c52b7b240d33fc32570d59d6c1ab1ff7 /tests
parentMove third_party_rules check to event creation time (diff)
downloadsynapse-617e8a46538af56bd5abbb2c9e4df8025841c338.tar.xz
Allow ThirdPartyRules modules to replace event content
Support returning a new event dict from `check_event_allowed`.
Diffstat (limited to 'tests')
-rw-r--r--tests/rest/client/test_third_party_rules.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/rest/client/test_third_party_rules.py b/tests/rest/client/test_third_party_rules.py
index b737625e33..d404550800 100644
--- a/tests/rest/client/test_third_party_rules.py
+++ b/tests/rest/client/test_third_party_rules.py
@@ -115,12 +115,12 @@ class ThirdPartyRulesTestCase(unittest.HomeserverTestCase):
         self.assertEquals(channel.result["code"], b"403", channel.result)
 
     def test_modify_event(self):
-        """Tests that the module can successfully tweak an event before it is persisted.
-        """
+        """The module can return a modified version of the event"""
         # first patch the event checker so that it will modify the event
         async def check(ev: EventBase, state):
-            ev.content = {"x": "y"}
-            return True
+            d = ev.get_dict()
+            d["content"] = {"x": "y"}
+            return d
 
         current_rules_module().check_event_allowed = check