summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-26 16:03:25 +0100
committerErik Johnston <erik@matrix.org>2014-08-26 16:03:25 +0100
commitb1e98ddc093b04967dffa58a58c2bfee624870b8 (patch)
tree1b850cf728afa2f97859429b110a043bc1fdf63e /tests/utils.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into stream_refactor (diff)
parentAvoid double call of refresh at app startup (diff)
downloadsynapse-b1e98ddc093b04967dffa58a58c2bfee624870b8.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into stream_refactor
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/utils.py b/tests/utils.py
index c68b17f7b9..f40cbce51d 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -183,7 +183,7 @@ class MemoryDataStore(object):
     def persist_event(self, event):
         if event.type == RoomMemberEvent.TYPE:
             room_id = event.room_id
-            user = event.target_user_id
+            user = event.state_key
             membership = event.membership
             self.members.setdefault(room_id, {})[user] = event
 
@@ -196,7 +196,9 @@ class MemoryDataStore(object):
     def get_current_state(self, room_id, event_type=None, state_key=""):
         if event_type:
             key = (room_id, event_type, state_key)
-            return self.current_state.get(key)
+            if self.current_state.get(key):
+                return [self.current_state.get(key)]
+            return None
         else:
             return [
                 e for e in self.current_state
@@ -214,7 +216,7 @@ class MemoryDataStore(object):
 
 def _format_call(args, kwargs):
     return ", ".join(
-        ["%r" % (a) for a in args] + 
+        ["%r" % (a) for a in args] +
         ["%s=%r" % (k, v) for k, v in kwargs.items()]
     )