mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 10:14:57 -04:00
Add account data to export command (#14969)
* Add account data to to export command * newsfile * remove not needed function * update newsfile * adopt #14973
This commit is contained in:
parent
4f4f27e57f
commit
61bfcd669a
5 changed files with 79 additions and 16 deletions
|
@ -296,3 +296,30 @@ class ExfiltrateData(unittest.HomeserverTestCase):
|
|||
self.assertEqual(args[0][0]["user_agent"], "user_agent")
|
||||
self.assertGreater(args[0][0]["last_seen"], 0)
|
||||
self.assertNotIn("access_token", args[0][0])
|
||||
|
||||
def test_account_data(self) -> None:
|
||||
"""Tests that user account data get exported."""
|
||||
# add account data
|
||||
self.get_success(
|
||||
self._store.add_account_data_for_user(self.user2, "m.global", {"a": 1})
|
||||
)
|
||||
self.get_success(
|
||||
self._store.add_account_data_to_room(
|
||||
self.user2, "test_room", "m.per_room", {"b": 2}
|
||||
)
|
||||
)
|
||||
|
||||
writer = Mock()
|
||||
|
||||
self.get_success(self.admin_handler.export_user_data(self.user2, writer))
|
||||
|
||||
# two calls, one call for user data and one call for room data
|
||||
writer.write_account_data.assert_called()
|
||||
|
||||
args = writer.write_account_data.call_args_list[0][0]
|
||||
self.assertEqual(args[0], "global")
|
||||
self.assertEqual(args[1]["m.global"]["a"], 1)
|
||||
|
||||
args = writer.write_account_data.call_args_list[1][0]
|
||||
self.assertEqual(args[0], "test_room")
|
||||
self.assertEqual(args[1]["m.per_room"]["b"], 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue