mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-11 20:10:06 -04:00
Delete messages from device_inbox
table when deleting device (#10969)
Fixes: #9346
This commit is contained in:
parent
a930da3291
commit
8d46fac98e
6 changed files with 256 additions and 15 deletions
|
@ -160,6 +160,37 @@ class DeviceTestCase(unittest.HomeserverTestCase):
|
|||
# we'd like to check the access token was invalidated, but that's a
|
||||
# bit of a PITA.
|
||||
|
||||
def test_delete_device_and_device_inbox(self):
|
||||
self._record_users()
|
||||
|
||||
# add an device_inbox
|
||||
self.get_success(
|
||||
self.store.db_pool.simple_insert(
|
||||
"device_inbox",
|
||||
{
|
||||
"user_id": user1,
|
||||
"device_id": "abc",
|
||||
"stream_id": 1,
|
||||
"message_json": "{}",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
# delete the device
|
||||
self.get_success(self.handler.delete_device(user1, "abc"))
|
||||
|
||||
# check that the device_inbox was deleted
|
||||
res = self.get_success(
|
||||
self.store.db_pool.simple_select_one(
|
||||
table="device_inbox",
|
||||
keyvalues={"user_id": user1, "device_id": "abc"},
|
||||
retcols=("user_id", "device_id"),
|
||||
allow_none=True,
|
||||
desc="get_device_id_from_device_inbox",
|
||||
)
|
||||
)
|
||||
self.assertIsNone(res)
|
||||
|
||||
def test_update_device(self):
|
||||
self._record_users()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue