mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-11 18:40:02 -04:00
Make check_event_allowed
module API callback not fail open (accept events) when an exception is raised (#11033)
This commit is contained in:
parent
66bdca3e31
commit
69ab3dddbc
5 changed files with 24 additions and 17 deletions
|
@ -216,19 +216,9 @@ class ThirdPartyRulesTestCase(unittest.FederatingHomeserverTestCase):
|
|||
{"x": "x"},
|
||||
access_token=self.tok,
|
||||
)
|
||||
# check_event_allowed has some error handling, so it shouldn't 500 just because a
|
||||
# module did something bad.
|
||||
self.assertEqual(channel.code, 200, channel.result)
|
||||
event_id = channel.json_body["event_id"]
|
||||
|
||||
channel = self.make_request(
|
||||
"GET",
|
||||
"/_matrix/client/r0/rooms/%s/event/%s" % (self.room_id, event_id),
|
||||
access_token=self.tok,
|
||||
)
|
||||
self.assertEqual(channel.code, 200, channel.result)
|
||||
ev = channel.json_body
|
||||
self.assertEqual(ev["content"]["x"], "x")
|
||||
# Because check_event_allowed raises an exception, it leads to a
|
||||
# 500 Internal Server Error
|
||||
self.assertEqual(channel.code, 500, channel.result)
|
||||
|
||||
def test_modify_event(self):
|
||||
"""The module can return a modified version of the event"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue