summary refs log tree commit diff
path: root/tests/storage/test_keys.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-02-14 12:03:12 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-02-14 12:03:12 +0000
commitc9aab2de34ee36cf10eb6007a657b70dfe860469 (patch)
treedd11fbe5d9e9188a3fa2958a997453d37edb3df6 /tests/storage/test_keys.py
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-c9aab2de34ee36cf10eb6007a657b70dfe860469.tar.xz
Fix signedjson deleted method
Diffstat (limited to '')
-rw-r--r--tests/storage/test_keys.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/storage/test_keys.py b/tests/storage/test_keys.py
index e07ff01201..cef2112974 100644
--- a/tests/storage/test_keys.py
+++ b/tests/storage/test_keys.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 import signedjson.key
+import unpaddedbase64
 
 from twisted.internet.defer import Deferred
 
@@ -21,11 +22,17 @@ from synapse.storage.keys import FetchKeyResult
 
 import tests.unittest
 
-KEY_1 = signedjson.key.decode_verify_key_base64(
-    "ed25519", "key1", "fP5l4JzpZPq/zdbBg5xx6lQGAAOM9/3w94cqiJ5jPrw"
+
+def decode_verify_key_base64(key_id: str, key_base64: str):
+    key_bytes = unpaddedbase64.decode_base64(key_base64)
+    return signedjson.key.decode_verify_key_bytes(key_id, key_bytes)
+
+
+KEY_1 = decode_verify_key_base64(
+    "ed25519:key1", "fP5l4JzpZPq/zdbBg5xx6lQGAAOM9/3w94cqiJ5jPrw"
 )
-KEY_2 = signedjson.key.decode_verify_key_base64(
-    "ed25519", "key2", "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw"
+KEY_2 = decode_verify_key_base64(
+    "ed25519:key2", "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw"
 )
 
 
@@ -121,3 +128,4 @@ class KeyStoreTestCase(tests.unittest.HomeserverTestCase):
         res2 = res[("srv1", key_id_2)]
         self.assertEqual(res2.verify_key, new_key_2)
         self.assertEqual(res2.valid_until_ts, 300)
+