0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-16 15:01:23 +01:00

Fix tests

This commit is contained in:
Erik Johnston 2015-03-09 17:01:11 +00:00
parent 8e28db5cc9
commit 6d74e46621
3 changed files with 10 additions and 10 deletions

View file

@ -100,7 +100,7 @@ class PresenceTestCase(unittest.TestCase):
self.room_members = [] self.room_members = []
room_member_handler = handlers.room_member_handler = Mock(spec=[ room_member_handler = handlers.room_member_handler = Mock(spec=[
"get_rooms_for_user", "get_joined_rooms_for_user",
"get_room_members", "get_room_members",
"fetch_room_distributions_into", "fetch_room_distributions_into",
]) ])
@ -111,7 +111,7 @@ class PresenceTestCase(unittest.TestCase):
return defer.succeed([self.room_id]) return defer.succeed([self.room_id])
else: else:
return defer.succeed([]) return defer.succeed([])
room_member_handler.get_rooms_for_user = get_rooms_for_user room_member_handler.get_joined_rooms_for_user = get_rooms_for_user
def get_room_members(room_id): def get_room_members(room_id):
if room_id == self.room_id: if room_id == self.room_id:

View file

@ -64,7 +64,7 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
"set_presence_state", "set_presence_state",
"is_presence_visible", "is_presence_visible",
"set_profile_displayname", "set_profile_displayname",
"get_rooms_for_user_where_membership_is", "get_rooms_for_user",
]), ]),
handlers=None, handlers=None,
resource_for_federation=Mock(), resource_for_federation=Mock(),
@ -124,9 +124,9 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
self.mock_update_client) self.mock_update_client)
hs.handlers.room_member_handler = Mock(spec=[ hs.handlers.room_member_handler = Mock(spec=[
"get_rooms_for_user", "get_joined_rooms_for_user",
]) ])
hs.handlers.room_member_handler.get_rooms_for_user = ( hs.handlers.room_member_handler.get_joined_rooms_for_user = (
lambda u: defer.succeed([])) lambda u: defer.succeed([]))
# Some local users to test with # Some local users to test with
@ -138,7 +138,7 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
self.u_potato = UserID.from_string("@potato:remote") self.u_potato = UserID.from_string("@potato:remote")
self.mock_get_joined = ( self.mock_get_joined = (
self.datastore.get_rooms_for_user_where_membership_is self.datastore.get_rooms_for_user
) )
@defer.inlineCallbacks @defer.inlineCallbacks

View file

@ -79,13 +79,13 @@ class PresenceStateTestCase(unittest.TestCase):
room_member_handler = hs.handlers.room_member_handler = Mock( room_member_handler = hs.handlers.room_member_handler = Mock(
spec=[ spec=[
"get_rooms_for_user", "get_joined_rooms_for_user",
] ]
) )
def get_rooms_for_user(user): def get_rooms_for_user(user):
return defer.succeed([]) return defer.succeed([])
room_member_handler.get_rooms_for_user = get_rooms_for_user room_member_handler.get_joined_rooms_for_user = get_rooms_for_user
presence.register_servlets(hs, self.mock_resource) presence.register_servlets(hs, self.mock_resource)
@ -166,7 +166,7 @@ class PresenceListTestCase(unittest.TestCase):
hs.handlers.room_member_handler = Mock( hs.handlers.room_member_handler = Mock(
spec=[ spec=[
"get_rooms_for_user", "get_joined_rooms_for_user",
] ]
) )
@ -291,7 +291,7 @@ class PresenceEventStreamTestCase(unittest.TestCase):
return ["a-room"] return ["a-room"]
else: else:
return [] return []
hs.handlers.room_member_handler.get_rooms_for_user = get_rooms_for_user hs.handlers.room_member_handler.get_joined_rooms_for_user = get_rooms_for_user
self.mock_datastore = hs.get_datastore() self.mock_datastore = hs.get_datastore()
self.mock_datastore.get_app_service_by_token = Mock(return_value=None) self.mock_datastore.get_app_service_by_token = Mock(return_value=None)