From 3791b75000f9787806dbdce3e6e216da1ac07388 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 5 Nov 2014 13:48:36 +0000 Subject: [PATCH] Fix a couple more storage tests --- tests/storage/test_roommember.py | 24 +++++++++++++++--------- tests/storage/test_stream.py | 24 +++++++++++++++++------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/tests/storage/test_roommember.py b/tests/storage/test_roommember.py index eae278ee8..9e2b2e31c 100644 --- a/tests/storage/test_roommember.py +++ b/tests/storage/test_roommember.py @@ -51,16 +51,22 @@ class RoomMemberStoreTestCase(unittest.TestCase): @defer.inlineCallbacks def inject_room_member(self, room, user, membership): # Have to create a join event using the eventfactory + event = self.event_factory.create_event( + etype=RoomMemberEvent.TYPE, + user_id=user.to_string(), + state_key=user.to_string(), + room_id=room.to_string(), + membership=membership, + content={"membership": membership}, + depth=1, + prev_events=[], + ) + + event.state_events = None + event.hashes = {} + yield self.store.persist_event( - self.event_factory.create_event( - etype=RoomMemberEvent.TYPE, - user_id=user.to_string(), - state_key=user.to_string(), - room_id=room.to_string(), - membership=membership, - content={"membership": membership}, - depth=1, - ) + event ) @defer.inlineCallbacks diff --git a/tests/storage/test_stream.py b/tests/storage/test_stream.py index ab30e6ea2..b034fd8f1 100644 --- a/tests/storage/test_stream.py +++ b/tests/storage/test_stream.py @@ -59,8 +59,12 @@ class StreamStoreTestCase(unittest.TestCase): membership=membership, content={"membership": membership}, depth=self.depth, + prev_events=[], ) + event.state_events = None + event.hashes = {} + if prev_state: event.prev_state = prev_state @@ -75,15 +79,21 @@ class StreamStoreTestCase(unittest.TestCase): def inject_message(self, room, user, body): self.depth += 1 + event = self.event_factory.create_event( + etype=MessageEvent.TYPE, + user_id=user.to_string(), + room_id=room.to_string(), + content={"body": body, "msgtype": u"message"}, + depth=self.depth, + prev_events=[], + ) + + event.state_events = None + event.hashes = {} + # Have to create a join event using the eventfactory yield self.store.persist_event( - self.event_factory.create_event( - etype=MessageEvent.TYPE, - user_id=user.to_string(), - room_id=room.to_string(), - content={"body": body, "msgtype": u"message"}, - depth=self.depth, - ) + event ) @defer.inlineCallbacks