summary refs log tree commit diff
path: root/tests/rest
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-07-17 19:08:02 +0100
committerGitHub <noreply@github.com>2019-07-17 19:08:02 +0100
commit9c70a02a9cddf36521c3d6ae6f72e3b46a5f4c2d (patch)
tree832fb0a1fa57b763d5cdd4079d85d55f4c1be965 /tests/rest
parentImprove `Depends` specs in debian package. (#5675) (diff)
downloadsynapse-9c70a02a9cddf36521c3d6ae6f72e3b46a5f4c2d.tar.xz
Ignore redactions of m.room.create events (#5701)
Diffstat (limited to 'tests/rest')
-rw-r--r--tests/rest/client/test_redactions.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/rest/client/test_redactions.py b/tests/rest/client/test_redactions.py
index 7d5df95855..fe66e397c4 100644
--- a/tests/rest/client/test_redactions.py
+++ b/tests/rest/client/test_redactions.py
@@ -157,3 +157,23 @@ class RedactionsTestCase(HomeserverTestCase):
         self.assertEqual(timeline[-2]["event_id"], msg_id)
         self.assertEqual(timeline[-2]["unsigned"]["redacted_by"], redaction_id)
         self.assertEqual(timeline[-2]["content"], {})
+
+    def test_redact_create_event(self):
+        # control case: an existing event
+        b = self.helper.send(room_id=self.room_id, tok=self.mod_access_token)
+        msg_id = b["event_id"]
+        self._redact_event(self.mod_access_token, self.room_id, msg_id)
+
+        # sync the room, to get the id of the create event
+        timeline = self._sync_room_timeline(self.other_access_token, self.room_id)
+        create_event_id = timeline[0]["event_id"]
+
+        # room moderators cannot send redactions for create events
+        self._redact_event(
+            self.mod_access_token, self.room_id, create_event_id, expect_code=403
+        )
+
+        # and nor can normals
+        self._redact_event(
+            self.other_access_token, self.room_id, create_event_id, expect_code=403
+        )