summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorTravis Ralston <travisr@element.io>2024-07-05 04:56:52 -0600
committerGitHub <noreply@github.com>2024-07-05 11:56:52 +0100
commit2ec257d60849fd8e3065936e69f8d3f0e5bc34fb (patch)
tree985da9afc4bb620ef9d9ba5771702937ed01974d /tests
parentFix links in README (#17379) (diff)
downloadsynapse-2ec257d60849fd8e3065936e69f8d3f0e5bc34fb.tar.xz
Upon deactivation, forget all of the user's rooms (#17400)
This can help ensure that the rooms are eventually purged if the other
local users also forget them. Synapse already clears some of the room
information as part of the `_background_remove_left_rooms` background
task, but this doesn't catch `events`, `event_json`, etc.
Diffstat (limited to 'tests')
-rw-r--r--tests/handlers/test_deactivate_account.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/handlers/test_deactivate_account.py b/tests/handlers/test_deactivate_account.py
index c698771a06..d7b54383db 100644
--- a/tests/handlers/test_deactivate_account.py
+++ b/tests/handlers/test_deactivate_account.py
@@ -461,3 +461,25 @@ class DeactivateAccountTestCase(HomeserverTestCase):
         # Validate that there is no displayname in any of the events
         for event in events:
             self.assertTrue("displayname" not in event.content)
+
+    def test_rooms_forgotten_upon_deactivation(self) -> None:
+        """
+        Tests that the user 'forgets' the rooms they left upon deactivation.
+        """
+        # Create a room
+        room_id = self.helper.create_room_as(
+            self.user,
+            is_public=True,
+            tok=self.token,
+        )
+
+        # Deactivate the account
+        self._deactivate_my_account()
+
+        # Get all of the user's forgotten rooms
+        forgotten_rooms = self.get_success(
+            self._store.get_forgotten_rooms_for_user(self.user)
+        )
+
+        # Validate that the created room is forgotten
+        self.assertTrue(room_id in forgotten_rooms)