Skip to content
Snippets Groups Projects
Commit e72b16f9 authored by Erik Johnston's avatar Erik Johnston
Browse files

Fix redaction tests

parent 8cdebce4
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,7 @@ class RedactionTestCase(unittest.TestCase): ...@@ -102,7 +102,7 @@ class RedactionTestCase(unittest.TestCase):
@defer.inlineCallbacks @defer.inlineCallbacks
def inject_redaction(self, room, event_id, user, reason): def inject_redaction(self, room, event_id, user, reason):
builder = self.event_builder_factory.new({ builder = self.event_builder_factory.new({
"type": MessageEvent.TYPE, "type": RoomRedactionEvent.TYPE,
"sender": user.to_string(), "sender": user.to_string(),
"state_key": user.to_string(), "state_key": user.to_string(),
"room_id": room.to_string(), "room_id": room.to_string(),
...@@ -170,6 +170,10 @@ class RedactionTestCase(unittest.TestCase): ...@@ -170,6 +170,10 @@ class RedactionTestCase(unittest.TestCase):
event = results[0] event = results[0]
self.assertEqual(msg_event.event_id, event.event_id)
self.assertTrue("redacted_because" in event.unsigned)
self.assertObjectHasAttributes( self.assertObjectHasAttributes(
{ {
"type": MessageEvent.TYPE, "type": MessageEvent.TYPE,
...@@ -179,8 +183,6 @@ class RedactionTestCase(unittest.TestCase): ...@@ -179,8 +183,6 @@ class RedactionTestCase(unittest.TestCase):
event, event,
) )
self.assertTrue("redacted_because" in event.unsigned)
self.assertObjectHasAttributes( self.assertObjectHasAttributes(
{ {
"type": RoomRedactionEvent.TYPE, "type": RoomRedactionEvent.TYPE,
...@@ -247,6 +249,8 @@ class RedactionTestCase(unittest.TestCase): ...@@ -247,6 +249,8 @@ class RedactionTestCase(unittest.TestCase):
event = results[0] event = results[0]
self.assertTrue("redacted_because" in event.unsigned)
self.assertObjectHasAttributes( self.assertObjectHasAttributes(
{ {
"type": RoomMemberEvent.TYPE, "type": RoomMemberEvent.TYPE,
...@@ -256,13 +260,11 @@ class RedactionTestCase(unittest.TestCase): ...@@ -256,13 +260,11 @@ class RedactionTestCase(unittest.TestCase):
event, event,
) )
self.assertTrue(hasattr(event, "redacted_because"))
self.assertObjectHasAttributes( self.assertObjectHasAttributes(
{ {
"type": RoomRedactionEvent.TYPE, "type": RoomRedactionEvent.TYPE,
"user_id": self.u_alice.to_string(), "user_id": self.u_alice.to_string(),
"content": {"reason": reason}, "content": {"reason": reason},
}, },
event.redacted_because, event.unsigned["redacted_because"],
) )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment