summary refs log tree commit diff
path: root/tests/storage/test_redaction.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-11 13:38:52 +0000
committerErik Johnston <erik@matrix.org>2014-12-11 13:38:52 +0000
commite72b16f9a37ca335fdc24224a3b8e403ff7d3085 (patch)
tree59b79827da244a2ee044b0f0c01be3cf69611977 /tests/storage/test_redaction.py
parentFix redactions. Fix 'age' key (diff)
downloadsynapse-e72b16f9a37ca335fdc24224a3b8e403ff7d3085.tar.xz
Fix redaction tests
Diffstat (limited to 'tests/storage/test_redaction.py')
-rw-r--r--tests/storage/test_redaction.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/storage/test_redaction.py b/tests/storage/test_redaction.py
index d81f7add1c..f670e154c3 100644
--- a/tests/storage/test_redaction.py
+++ b/tests/storage/test_redaction.py
@@ -102,7 +102,7 @@ class RedactionTestCase(unittest.TestCase):
     @defer.inlineCallbacks
     def inject_redaction(self, room, event_id, user, reason):
         builder = self.event_builder_factory.new({
-            "type": MessageEvent.TYPE,
+            "type": RoomRedactionEvent.TYPE,
             "sender": user.to_string(),
             "state_key": user.to_string(),
             "room_id": room.to_string(),
@@ -170,6 +170,10 @@ class RedactionTestCase(unittest.TestCase):
 
         event = results[0]
 
+        self.assertEqual(msg_event.event_id, event.event_id)
+
+        self.assertTrue("redacted_because" in event.unsigned)
+
         self.assertObjectHasAttributes(
             {
                 "type": MessageEvent.TYPE,
@@ -179,8 +183,6 @@ class RedactionTestCase(unittest.TestCase):
             event,
         )
 
-        self.assertTrue("redacted_because" in event.unsigned)
-
         self.assertObjectHasAttributes(
             {
                 "type": RoomRedactionEvent.TYPE,
@@ -247,6 +249,8 @@ class RedactionTestCase(unittest.TestCase):
 
         event = results[0]
 
+        self.assertTrue("redacted_because" in event.unsigned)
+
         self.assertObjectHasAttributes(
             {
                 "type": RoomMemberEvent.TYPE,
@@ -256,13 +260,11 @@ class RedactionTestCase(unittest.TestCase):
             event,
         )
 
-        self.assertTrue(hasattr(event, "redacted_because"))
-
         self.assertObjectHasAttributes(
             {
                 "type": RoomRedactionEvent.TYPE,
                 "user_id": self.u_alice.to_string(),
                 "content": {"reason": reason},
             },
-            event.redacted_because,
+            event.unsigned["redacted_because"],
         )