diff --git a/tests/handlers/test_typing.py b/tests/handlers/test_typing.py
index 3955e7f5b1..d38ca37d63 100644
--- a/tests/handlers/test_typing.py
+++ b/tests/handlers/test_typing.py
@@ -71,6 +71,7 @@ class TypingNotificationsTestCase(unittest.TestCase):
self.auth = Mock(spec=[])
hs = yield setup_test_homeserver(
+ "test",
auth=self.auth,
clock=self.clock,
datastore=Mock(spec=[
@@ -110,56 +111,16 @@ class TypingNotificationsTestCase(unittest.TestCase):
self.room_id = "a-room"
- # Mock the RoomMemberHandler
- hs.handlers.room_member_handler = Mock(spec=[])
- self.room_member_handler = hs.handlers.room_member_handler
-
self.room_members = []
- def get_rooms_for_user(user):
- if user in self.room_members:
- return defer.succeed([self.room_id])
- else:
- return defer.succeed([])
- self.room_member_handler.get_rooms_for_user = get_rooms_for_user
-
- def get_room_members(room_id):
- if room_id == self.room_id:
- return defer.succeed(self.room_members)
- else:
- return defer.succeed([])
- self.room_member_handler.get_room_members = get_room_members
-
- def get_joined_rooms_for_user(user):
- if user in self.room_members:
- return defer.succeed([self.room_id])
- else:
- return defer.succeed([])
- self.room_member_handler.get_joined_rooms_for_user = get_joined_rooms_for_user
-
- @defer.inlineCallbacks
- def fetch_room_distributions_into(
- room_id, localusers=None, remotedomains=None, ignore_user=None
- ):
- members = yield get_room_members(room_id)
- for member in members:
- if ignore_user is not None and member == ignore_user:
- continue
-
- if hs.is_mine(member):
- if localusers is not None:
- localusers.add(member)
- else:
- if remotedomains is not None:
- remotedomains.add(member.domain)
- self.room_member_handler.fetch_room_distributions_into = (
- fetch_room_distributions_into
- )
-
def check_joined_room(room_id, user_id):
if user_id not in [u.to_string() for u in self.room_members]:
raise AuthError(401, "User is not in the room")
+ def get_joined_hosts_for_room(room_id):
+ return set(member.domain for member in self.room_members)
+ self.datastore.get_joined_hosts_for_room = get_joined_hosts_for_room
+
self.auth.check_joined_room = check_joined_room
# Some local users to test with
diff --git a/tests/storage/test_roommember.py b/tests/storage/test_roommember.py
index 997090fe35..27b2b3d123 100644
--- a/tests/storage/test_roommember.py
+++ b/tests/storage/test_roommember.py
@@ -71,12 +71,6 @@ class RoomMemberStoreTestCase(unittest.TestCase):
yield self.inject_room_member(self.room, self.u_alice, Membership.JOIN)
self.assertEquals(
- [self.u_alice.to_string()],
- [m.user_id for m in (
- yield self.store.get_room_members(self.room.to_string())
- )]
- )
- self.assertEquals(
[self.room.to_string()],
[m.room_id for m in (
yield self.store.get_rooms_for_user_where_membership_is(
@@ -86,18 +80,6 @@ class RoomMemberStoreTestCase(unittest.TestCase):
)
@defer.inlineCallbacks
- def test_two_members(self):
- yield self.inject_room_member(self.room, self.u_alice, Membership.JOIN)
- yield self.inject_room_member(self.room, self.u_bob, Membership.JOIN)
-
- self.assertEquals(
- {self.u_alice.to_string(), self.u_bob.to_string()},
- {m.user_id for m in (
- yield self.store.get_room_members(self.room.to_string())
- )}
- )
-
- @defer.inlineCallbacks
def test_room_hosts(self):
yield self.inject_room_member(self.room, self.u_alice, Membership.JOIN)
diff --git a/tests/utils.py b/tests/utils.py
index 9d7978a642..59d985b5f2 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -50,7 +50,7 @@ def setup_test_homeserver(name="test", datastore=None, config=None, **kargs):
config.enable_registration = True
config.macaroon_secret_key = "not even a little secret"
config.expire_access_token = False
- config.server_name = "server.under.test"
+ config.server_name = name
config.trusted_third_party_id_servers = []
config.room_invite_state_types = []
|