diff options
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r-- | tests/hazmat/backends/test_backendinit.py | 17 | ||||
-rw-r--r-- | tests/hazmat/backends/test_commoncrypto.py | 54 |
2 files changed, 0 insertions, 71 deletions
diff --git a/tests/hazmat/backends/test_backendinit.py b/tests/hazmat/backends/test_backendinit.py deleted file mode 100644 index b930f99f..00000000 --- a/tests/hazmat/backends/test_backendinit.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -from __future__ import absolute_import, division, print_function - -from cryptography.hazmat.backends import _backend_import_fallback - - -def test_backend_import_fallback_empty_backends(): - backends = _backend_import_fallback([]) - assert len(backends) >= 1 - - -def test_backend_import_fallback_existing_backends(): - backend_list = [1, 2, 3, 4] - assert backend_list == _backend_import_fallback(backend_list) diff --git a/tests/hazmat/backends/test_commoncrypto.py b/tests/hazmat/backends/test_commoncrypto.py deleted file mode 100644 index 2b730e93..00000000 --- a/tests/hazmat/backends/test_commoncrypto.py +++ /dev/null @@ -1,54 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -from __future__ import absolute_import, division, print_function - -import pytest - -from cryptography.exceptions import InternalError, _Reasons -from cryptography.hazmat.backends import _available_backends -from cryptography.hazmat.primitives.ciphers import Cipher -from cryptography.hazmat.primitives.ciphers.algorithms import AES -from cryptography.hazmat.primitives.ciphers.modes import CBC, GCM - -from ...doubles import DummyCipherAlgorithm -from ...utils import raises_unsupported_algorithm - - -@pytest.mark.skipif("commoncrypto" not in - [i.name for i in _available_backends()], - reason="CommonCrypto not available") -class TestCommonCrypto(object): - def test_supports_cipher(self): - from cryptography.hazmat.backends.commoncrypto.backend import backend - assert backend.cipher_supported(None, None) is False - - def test_register_duplicate_cipher_adapter(self): - from cryptography.hazmat.backends.commoncrypto.backend import backend - with pytest.raises(ValueError): - backend._register_cipher_adapter( - AES, backend._lib.kCCAlgorithmAES128, - CBC, backend._lib.kCCModeCBC - ) - - def test_handle_response(self): - from cryptography.hazmat.backends.commoncrypto.backend import backend - - with pytest.raises(ValueError): - backend._check_cipher_response(backend._lib.kCCAlignmentError) - - with pytest.raises(InternalError): - backend._check_cipher_response(backend._lib.kCCMemoryFailure) - - with pytest.raises(InternalError): - backend._check_cipher_response(backend._lib.kCCDecodeError) - - def test_nonexistent_aead_cipher(self): - from cryptography.hazmat.backends.commoncrypto.backend import Backend - b = Backend() - cipher = Cipher( - DummyCipherAlgorithm(), GCM(b"fake_iv_here"), backend=b, - ) - with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_CIPHER): - cipher.encryptor() |