summary refs log tree commit diff
path: root/tests/handlers
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2023-05-03 12:27:33 +0100
committerGitHub <noreply@github.com>2023-05-03 12:27:33 +0100
commit04e79e6a185f466c9a2c8d79f6c9de7f42efc6f7 (patch)
treebab1b9e35eb480c7b33a2f3d886cc42db4c420a4 /tests/handlers
parentRemove references to supporting per-user flag for msc2654 (#15522) (diff)
downloadsynapse-04e79e6a185f466c9a2c8d79f6c9de7f42efc6f7.tar.xz
Add config option to forget rooms automatically when users leave them (#15224)
This is largely based off the stats and user directory updater code.

Signed-off-by: Sean Quah <seanq@matrix.org>
Diffstat (limited to 'tests/handlers')
-rw-r--r--tests/handlers/test_room_member.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/handlers/test_room_member.py b/tests/handlers/test_room_member.py
index 6a38893b68..a444d822cd 100644
--- a/tests/handlers/test_room_member.py
+++ b/tests/handlers/test_room_member.py
@@ -333,6 +333,17 @@ class RoomMemberMasterHandlerTestCase(HomeserverTestCase):
             self.get_success(self.store.is_locally_forgotten_room(self.room_id))
         )
 
+    @override_config({"forget_rooms_on_leave": True})
+    def test_leave_and_auto_forget(self) -> None:
+        """Tests the `forget_rooms_on_leave` config option."""
+        self.helper.join(self.room_id, user=self.bob, tok=self.bob_token)
+
+        # alice is not the last room member that leaves and forgets the room
+        self.helper.leave(self.room_id, user=self.alice, tok=self.alice_token)
+        self.assertTrue(
+            self.get_success(self.store.did_forget(self.alice, self.room_id))
+        )
+
     def test_leave_and_forget_last_user(self) -> None:
         """Tests that forget a room is successfully when the last user has left the room."""