aboutsummaryrefslogtreecommitdiff
path: root/python/tests/group_session_test.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2019-06-22 17:06:02 +0000
committerMatthew Hodgson <matthew@matrix.org>2019-06-22 17:06:02 +0000
commitae38f2c5a0db711ef573276bc745ee2384a197fa (patch)
tree6029aafbda99fe85c3fac43db2646b446d564917 /python/tests/group_session_test.py
parent25662564d415b9d5486f1915c9d46e5851b058d0 (diff)
parent61175c969b1de3ecd8c25478c69d6d1883dfa211 (diff)
Merge branch 'python/unicode_decode_errors' into 'master'
Python unicode decode errors when decrypting. See merge request matrix-org/olm!4
Diffstat (limited to 'python/tests/group_session_test.py')
-rw-r--r--python/tests/group_session_test.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/python/tests/group_session_test.py b/python/tests/group_session_test.py
index c17e84f..4632a60 100644
--- a/python/tests/group_session_test.py
+++ b/python/tests/group_session_test.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import pytest
from olm import InboundGroupSession, OlmGroupSessionError, OutboundGroupSession
@@ -112,3 +113,16 @@ class TestClass(object):
outbound = OutboundGroupSession()
inbound = InboundGroupSession(outbound.session_key)
del inbound
+
+ def test_invalid_unicode_decrypt(self):
+ outbound = OutboundGroupSession()
+ inbound = InboundGroupSession(outbound.session_key)
+
+ text = outbound.encrypt(b"\xed")
+ plaintext, _ = inbound.decrypt(text)
+
+ print(plaintext)
+ assert plaintext == u"�"
+
+ plaintext, _ = inbound.decrypt(text, "ignore")
+ assert plaintext == ""