summary refs log tree commit diff
path: root/tests/crypto/test_keyring.py
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2023-04-13 14:35:03 +0000
committerGitHub <noreply@github.com>2023-04-13 15:35:03 +0100
commitedae20f926d9d1225111f1d40a1073ce3f1d3fb7 (patch)
tree900cb6fdfa14849a766f009655911ab0e52e9249 /tests/crypto/test_keyring.py
parentAdd comma missing from #15382. (#15429) (diff)
downloadsynapse-edae20f926d9d1225111f1d40a1073ce3f1d3fb7.tar.xz
Improve robustness when handling a perspective key response by deduplicating received server keys. (#15423)
* Change `store_server_verify_keys` to take a `Mapping[(str, str), FKR]`

This is because we already can't handle duplicate keys — leads to cardinality violation

* Newsfile

Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>

---------

Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
Diffstat (limited to 'tests/crypto/test_keyring.py')
-rw-r--r--tests/crypto/test_keyring.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/crypto/test_keyring.py b/tests/crypto/test_keyring.py
index 1b9696748f..66102ab934 100644
--- a/tests/crypto/test_keyring.py
+++ b/tests/crypto/test_keyring.py
@@ -193,7 +193,7 @@ class KeyringTestCase(unittest.HomeserverTestCase):
         r = self.hs.get_datastores().main.store_server_verify_keys(
             "server9",
             int(time.time() * 1000),
-            [("server9", get_key_id(key1), FetchKeyResult(get_verify_key(key1), 1000))],
+            {("server9", get_key_id(key1)): FetchKeyResult(get_verify_key(key1), 1000)},
         )
         self.get_success(r)
 
@@ -291,7 +291,7 @@ class KeyringTestCase(unittest.HomeserverTestCase):
             # None is not a valid value in FetchKeyResult, but we're abusing this
             # API to insert null values into the database. The nulls get converted
             # to 0 when fetched in KeyStore.get_server_verify_keys.
-            [("server9", get_key_id(key1), FetchKeyResult(get_verify_key(key1), None))],  # type: ignore[arg-type]
+            {("server9", get_key_id(key1)): FetchKeyResult(get_verify_key(key1), None)},  # type: ignore[arg-type]
         )
         self.get_success(r)