From 0e48f7f2458f08341131b3b90c78b7034fe02d14 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Jan 2016 16:46:41 +0000 Subject: [PATCH] fix tests --- tests/handlers/test_federation.py | 4 ++++ tests/handlers/test_room.py | 5 +++++ tests/storage/test_registration.py | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/handlers/test_federation.py b/tests/handlers/test_federation.py index 6acc4ebad..029c09411 100644 --- a/tests/handlers/test_federation.py +++ b/tests/handlers/test_federation.py @@ -53,6 +53,8 @@ class FederationTestCase(unittest.TestCase): "bulk_get_push_rules", "get_current_state", "set_push_actions_for_event_and_users", + "is_guest", + "get_state_for_events", ]), resource_for_federation=NonCallableMock(), http_client=NonCallableMock(spec_set=[]), @@ -73,6 +75,8 @@ class FederationTestCase(unittest.TestCase): self.handlers.federation_handler = FederationHandler(self.hs) + self.datastore.get_state_for_events.return_value = {"$a:b": {}} + @defer.inlineCallbacks def test_msg(self): pdu = FrozenEvent({ diff --git a/tests/handlers/test_room.py b/tests/handlers/test_room.py index ff2b59712..b1c8e6152 100644 --- a/tests/handlers/test_room.py +++ b/tests/handlers/test_room.py @@ -47,6 +47,8 @@ class RoomMemberHandlerTestCase(unittest.TestCase): "bulk_get_push_rules", "get_current_state", "set_push_actions_for_event_and_users", + "get_state_for_events", + "is_guest", ]), resource_for_federation=NonCallableMock(), http_client=NonCallableMock(spec_set=[]), @@ -116,6 +118,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase): defer.succeed([]) ) self.datastore.get_current_state.return_value = {} + self.datastore.get_state_for_events = lambda event_ids,types: {x: {} for x in event_ids} def annotate(_): ctx = Mock() @@ -198,6 +201,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase): defer.succeed([]) ) self.datastore.get_current_state.return_value = {} + self.datastore.get_state_for_events = lambda event_ids,types: {x: {} for x in event_ids} def annotate(_): ctx = Mock() @@ -274,6 +278,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase): defer.succeed([]) ) self.datastore.get_current_state.return_value = {} + self.datastore.get_state_for_events = lambda event_ids,types: {x: {} for x in event_ids} def annotate(_): ctx = Mock() diff --git a/tests/storage/test_registration.py b/tests/storage/test_registration.py index 0cce6c37d..4760131f9 100644 --- a/tests/storage/test_registration.py +++ b/tests/storage/test_registration.py @@ -45,7 +45,7 @@ class RegistrationStoreTestCase(unittest.TestCase): self.assertEquals( # TODO(paul): Surely this field should be 'user_id', not 'name' # Additionally surely it shouldn't come in a 1-element list - {"name": self.user_id, "password_hash": self.pwhash}, + {"name": self.user_id, "password_hash": self.pwhash, "is_guest": 0}, (yield self.store.get_user_by_id(self.user_id)) )