diff options
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r-- | tests/hazmat/primitives/test_cmac.py | 15 | ||||
-rw-r--r-- | tests/hazmat/primitives/test_hashes.py | 11 | ||||
-rw-r--r-- | tests/hazmat/primitives/test_hmac.py | 11 |
3 files changed, 1 insertions, 36 deletions
diff --git a/tests/hazmat/primitives/test_cmac.py b/tests/hazmat/primitives/test_cmac.py index 08b6bf5d..2ca05d6d 100644 --- a/tests/hazmat/primitives/test_cmac.py +++ b/tests/hazmat/primitives/test_cmac.py @@ -6,8 +6,6 @@ from __future__ import absolute_import, division, print_function import binascii -import pretend - import pytest from cryptography.exceptions import ( @@ -19,11 +17,11 @@ from cryptography.hazmat.primitives.ciphers.algorithms import ( ) from cryptography.hazmat.primitives.cmac import CMAC -from ..backends.test_multibackend import DummyCMACBackend from ...utils import ( load_nist_vectors, load_vectors_from_file, raises_unsupported_algorithm ) + vectors_aes128 = load_vectors_from_file( "CMAC/nist-800-38b-aes128.txt", load_nist_vectors) @@ -186,17 +184,6 @@ class TestCMAC(object): assert cmac.finalize() == copy_cmac.finalize() -def test_copy(): - backend = DummyCMACBackend([AES]) - copied_ctx = pretend.stub() - pretend_ctx = pretend.stub(copy=lambda: copied_ctx) - key = b"2b7e151628aed2a6abf7158809cf4f3c" - cmac = CMAC(AES(key), backend=backend, ctx=pretend_ctx) - - assert cmac._backend is backend - assert cmac.copy()._backend is backend - - def test_invalid_backend(): key = b"2b7e151628aed2a6abf7158809cf4f3c" pretend_backend = object() diff --git a/tests/hazmat/primitives/test_hashes.py b/tests/hazmat/primitives/test_hashes.py index fe96b322..0e817666 100644 --- a/tests/hazmat/primitives/test_hashes.py +++ b/tests/hazmat/primitives/test_hashes.py @@ -4,8 +4,6 @@ from __future__ import absolute_import, division, print_function -import pretend - import pytest from cryptography.exceptions import AlreadyFinalized, _Reasons @@ -13,7 +11,6 @@ from cryptography.hazmat.backends.interfaces import HashBackend from cryptography.hazmat.primitives import hashes from .utils import generate_base_hash_test -from ..backends.test_multibackend import DummyHashBackend from ...doubles import DummyHashAlgorithm from ...utils import raises_unsupported_algorithm @@ -25,14 +22,6 @@ class TestHashContext(object): with pytest.raises(TypeError): m.update(u"\u00FC") - def test_copy_backend_object(self): - backend = DummyHashBackend([hashes.SHA1]) - copied_ctx = pretend.stub() - pretend_ctx = pretend.stub(copy=lambda: copied_ctx) - h = hashes.Hash(hashes.SHA1(), backend=backend, ctx=pretend_ctx) - assert h._backend is backend - assert h.copy()._backend is h._backend - def test_hash_algorithm_instance(self, backend): with pytest.raises(TypeError): hashes.Hash(hashes.SHA1, backend=backend) diff --git a/tests/hazmat/primitives/test_hmac.py b/tests/hazmat/primitives/test_hmac.py index 82082a2d..50aa9cc2 100644 --- a/tests/hazmat/primitives/test_hmac.py +++ b/tests/hazmat/primitives/test_hmac.py @@ -4,8 +4,6 @@ from __future__ import absolute_import, division, print_function -import pretend - import pytest from cryptography.exceptions import ( @@ -15,7 +13,6 @@ from cryptography.hazmat.backends.interfaces import HMACBackend from cryptography.hazmat.primitives import hashes, hmac from .utils import generate_base_hmac_test -from ..backends.test_multibackend import DummyHMACBackend from ...doubles import DummyHashAlgorithm from ...utils import raises_unsupported_algorithm @@ -38,14 +35,6 @@ class TestHMAC(object): with pytest.raises(TypeError): h.update(u"\u00FC") - def test_copy_backend_object(self): - backend = DummyHMACBackend([hashes.SHA1]) - copied_ctx = pretend.stub() - pretend_ctx = pretend.stub(copy=lambda: copied_ctx) - h = hmac.HMAC(b"key", hashes.SHA1(), backend=backend, ctx=pretend_ctx) - assert h._backend is backend - assert h.copy()._backend is backend - def test_hmac_algorithm_instance(self, backend): with pytest.raises(TypeError): hmac.HMAC(b"key", hashes.SHA1, backend=backend) |