diff options
-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) |