Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit ff6212a

Browse files
author
David Robertson
committed
Add test covering appservice sender joining a room
I don't think this actually improves coverage as such, but I'll sleep better at night having this case checked!
1 parent 8d2025c commit ff6212a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/handlers/test_user_directory.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
6363
hostname="test",
6464
id="1234",
6565
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
66-
sender="@as:test",
66+
# Note: this user does not match the regex above, so that tests
67+
# can distinguish the sender from the AS user.
68+
sender="@as_main:test",
6769
)
6870

6971
mock_load_appservices = Mock(return_value=[self.appservice])
@@ -179,6 +181,15 @@ def test_excludes_appservices_user(self) -> None:
179181
)
180182
self._check_only_one_user_in_directory(user, public)
181183

184+
def test_excludes_appservice_sender(self) -> None:
185+
user = self.register_user("user", "pass")
186+
token = self.login(user, "pass")
187+
room = self.helper.create_room_as(
188+
self.appservice.sender, is_public=True, tok=self.appservice.token
189+
)
190+
self.helper.join(room, user, tok=token)
191+
self._check_only_one_user_in_directory(user, room)
192+
182193
def _create_rooms_and_inject_memberships(
183194
self, creator: str, token: str, joiner: str
184195
) -> Tuple[str, str]:

0 commit comments

Comments
 (0)