diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2020-03-09 13:16:53 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2020-03-09 13:36:13 +0100 |
commit | 7f98fca157b50708dd2c4848886e18a198e258c3 (patch) | |
tree | 720810ccfd84354136f19abafce71aac44006d22 /tests | |
parent | 77e6726d23b7d104852d0df61ecd2b4988616bf9 (diff) | |
download | m2crypto-7f98fca157b50708dd2c4848886e18a198e258c3.tar.gz |
base64.decodestring() was finally removed in Python 3.8.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_x509.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py index 057d7da..138af27 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -15,7 +15,7 @@ import os import time import warnings -from M2Crypto import ASN1, BIO, EVP, RSA, Rand, X509, m2 # noqa +from M2Crypto import ASN1, BIO, EVP, RSA, Rand, X509, m2, six # noqa from tests import unittest log = logging.getLogger(__name__) @@ -592,7 +592,10 @@ class X509StackTestCase(unittest.TestCase): with warnings.catch_warnings(): warnings.simplefilter('ignore', DeprecationWarning) - seq = base64.decodestring(b64) + if six.PY3: + seq = base64.decodebytes(b64) + else: + seq = base64.decodestring(b64) stack = X509.new_stack_from_der(seq) cert = stack.pop() @@ -612,7 +615,10 @@ class X509StackTestCase(unittest.TestCase): with warnings.catch_warnings(): warnings.simplefilter('ignore', DeprecationWarning) - seq = base64.decodestring(b64) + if six.PY3: + seq = base64.decodebytes(b64) + else: + seq = base64.decodestring(b64) stack = X509.new_stack_from_der(seq) num = len(stack) |