diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hazmat/backends/test_openssl.py | 5 | ||||
-rw-r--r-- | tests/hazmat/bindings/test_openssl.py | 18 |
2 files changed, 8 insertions, 15 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index 20c073a4..e857ff61 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -127,10 +127,7 @@ class TestOpenSSL(object): def test_error_strings_loaded(self): # returns a value in a static buffer err = backend._lib.ERR_error_string(101183626, backend._ffi.NULL) - assert backend._ffi.string(err) == ( - b"error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:" - b"data not multiple of block length" - ) + assert b"data not multiple of block length" in backend._ffi.string(err) def test_unknown_error_in_cipher_finalize(self): cipher = Cipher(AES(b"\0" * 16), CBC(b"\0" * 16), backend=backend) diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py index 9b0da67c..488f64e1 100644 --- a/tests/hazmat/bindings/test_openssl.py +++ b/tests/hazmat/bindings/test_openssl.py @@ -8,7 +8,7 @@ import pytest from cryptography.exceptions import InternalError from cryptography.hazmat.bindings.openssl.binding import ( - Binding, _OpenSSLErrorWithText, _consume_errors, _openssl_assert + Binding, _consume_errors, _openssl_assert ) @@ -94,16 +94,12 @@ class TestOpenSSL(object): with pytest.raises(InternalError) as exc_info: _openssl_assert(b.lib, False) - assert exc_info.value.err_code == [_OpenSSLErrorWithText( - code=101183626, - lib=b.lib.ERR_LIB_EVP, - func=b.lib.EVP_F_EVP_ENCRYPTFINAL_EX, - reason=b.lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH, - reason_text=( - b'error:0607F08A:digital envelope routines:EVP_EncryptFinal_' - b'ex:data not multiple of block length' - ) - )] + error = exc_info.value.err_code[0] + assert error.code == 101183626 + assert error.lib == b.lib.ERR_LIB_EVP + assert error.func == b.lib.EVP_F_EVP_ENCRYPTFINAL_EX + assert error.reason == b.lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH + assert b"data not multiple of block length" in error.reason_text def test_check_startup_errors_are_allowed(self): b = Binding() |