aboutsummaryrefslogtreecommitdiff
path: root/python/tests/account_test.py
diff options
context:
space:
mode:
authorDamir Jelić <poljar@termina.org.uk>2019-01-23 17:49:42 +0100
committerHubert Chathi <hubert@uhoreg.ca>2019-01-23 17:10:44 -0500
commit45091c158d956ebb6c23acfe4dcb1f147df55d4a (patch)
tree8478b84053773e2a27dafb92cefa34c67559e3a6 /python/tests/account_test.py
parent94f664e7256215f33639dbbad6aaf87ada082a9f (diff)
python: Turn the signature buffer into a bytearray.
This is a workaround for a bug where signature verification would overwrite the variable holding the signature. This only happens on python2. Signed-off-by: Damir Jelić <poljar@termina.org.uk>
Diffstat (limited to 'python/tests/account_test.py')
-rw-r--r--python/tests/account_test.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/tests/account_test.py b/python/tests/account_test.py
index 4fef72c..7ee6d2b 100644
--- a/python/tests/account_test.py
+++ b/python/tests/account_test.py
@@ -98,3 +98,19 @@ class TestClass(object):
with pytest.raises(OlmVerifyError):
ed25519_verify(signing_key, message, signature)
+
+ @given(text())
+ def test_signature_verification_twice(self, message):
+ alice = Account()
+
+ signature = alice.sign(message)
+ signing_key = alice.identity_keys["ed25519"]
+
+ assert signature
+ assert signing_key
+
+ ed25519_verify(signing_key, message, signature)
+ assert signature == alice.sign(message)
+
+ ed25519_verify(signing_key, message, signature)
+ assert signature == alice.sign(message)