diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2021-10-04 15:33:42 +0100 |
---|---|---|
committer | Brendan Abolivier <babolivier@matrix.org> | 2021-10-04 15:33:42 +0100 |
commit | 730b40dd5e94022657845f98a0a9577c3e8b4935 (patch) | |
tree | 1022faf7e34c87c2aae1f158573121ee3146bc0b /tests/storage | |
parent | Consistently exclude from user_directory (#10960) (diff) | |
parent | 1.44.0rc3 (diff) | |
download | synapse-730b40dd5e94022657845f98a0a9577c3e8b4935.tar.xz |
Merge tag 'v1.44.0rc3' into develop
Synapse 1.44.0rc3 (2021-10-04) ============================== Bugfixes -------- - Fix a bug introduced in Synapse v1.40.0 where changing a user's display name or avatar in a restricted room would cause an authentication error. ([\#10933](https://github.com/matrix-org/synapse/issues/10933)) - Fix `/admin/whois/{user_id}` endpoint, which was broken in v1.44.0rc1. ([\#10968](https://github.com/matrix-org/synapse/issues/10968))
Diffstat (limited to 'tests/storage')
-rw-r--r-- | tests/storage/test_client_ips.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/storage/test_client_ips.py b/tests/storage/test_client_ips.py index 1c2df54ecc..3cc8038f1e 100644 --- a/tests/storage/test_client_ips.py +++ b/tests/storage/test_client_ips.py @@ -15,9 +15,12 @@ from unittest.mock import Mock +from parameterized import parameterized + import synapse.rest.admin from synapse.http.site import XForwardedForRequest from synapse.rest.client import login +from synapse.types import UserID from tests import unittest from tests.server import make_request @@ -143,6 +146,37 @@ class ClientIpStoreTestCase(unittest.HomeserverTestCase): ], ) + @parameterized.expand([(False,), (True,)]) + def test_get_user_ip_and_agents(self, after_persisting: bool): + """Test `get_user_ip_and_agents` for persisted and unpersisted data""" + self.reactor.advance(12345678) + + user_id = "@user:id" + user = UserID.from_string(user_id) + + # Insert a user IP + self.get_success( + self.store.insert_client_ip( + user_id, "access_token", "ip", "user_agent", "MY_DEVICE" + ) + ) + + if after_persisting: + # Trigger the storage loop + self.reactor.advance(10) + + self.assertEqual( + self.get_success(self.store.get_user_ip_and_agents(user)), + [ + { + "access_token": "access_token", + "ip": "ip", + "user_agent": "user_agent", + "last_seen": 12345678000, + }, + ], + ) + @override_config({"limit_usage_by_mau": False, "max_mau_value": 50}) def test_disabled_monthly_active_user(self): user_id = "@user:server" |