diff options
author | Mathieu Velten <matmaul@gmail.com> | 2023-12-04 13:31:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 12:31:42 +0000 |
commit | 9e7f80037d08619cdd193831540d34e9ed5aacd7 (patch) | |
tree | 6571e3ff2821fb876e3b37fe57ee15a20b0a8ca8 /tests | |
parent | Bump matrix-org/netlify-pr-preview from 2 to 3 (#16719) (diff) | |
download | synapse-9e7f80037d08619cdd193831540d34e9ed5aacd7.tar.xz |
Server notices: add an autojoin setting for the notices room (#16699)
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/rest/admin/test_server_notice.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/rest/admin/test_server_notice.py b/tests/rest/admin/test_server_notice.py index dfd14f5751..2398bc503a 100644 --- a/tests/rest/admin/test_server_notice.py +++ b/tests/rest/admin/test_server_notice.py @@ -477,6 +477,33 @@ class ServerNoticeTestCase(unittest.HomeserverTestCase): # second room has new ID self.assertNotEqual(first_room_id, second_room_id) + @override_config( + {"server_notices": {"system_mxid_localpart": "notices", "auto_join": True}} + ) + def test_auto_join(self) -> None: + """ + Tests that the user get automatically joined to the notice room + when `auto_join` setting is used. + """ + # user has no room memberships + self._check_invite_and_join_status(self.other_user, 0, 0) + + # send server notice + server_notice_request_content = { + "user_id": self.other_user, + "content": {"msgtype": "m.text", "body": "test msg one"}, + } + + self.make_request( + "POST", + self.url, + access_token=self.admin_user_tok, + content=server_notice_request_content, + ) + + # user has joined the room + self._check_invite_and_join_status(self.other_user, 0, 1) + @override_config({"server_notices": {"system_mxid_localpart": "notices"}}) def test_update_notice_user_name_when_changed(self) -> None: """ |