diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-10-30 08:38:57 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-10-30 08:38:57 -0500 |
commit | 147703e9db15f4fddf13afc354a52e9777eb2dae (patch) | |
tree | fed948a7499ef19dcb4a30e53877edb7a17f73f2 /tests/hazmat/primitives/test_cmac.py | |
parent | 142abb566e63e9e15de8afe64be254e91e93c298 (diff) | |
parent | a201a2f7312dc542db1e833bfb195fcd2d957ee3 (diff) | |
download | cryptography-147703e9db15f4fddf13afc354a52e9777eb2dae.tar.gz cryptography-147703e9db15f4fddf13afc354a52e9777eb2dae.tar.bz2 cryptography-147703e9db15f4fddf13afc354a52e9777eb2dae.zip |
Merge pull request #1451 from alex/use-full-impls
When using a test double for backends, always use one which really implements the interface
Diffstat (limited to 'tests/hazmat/primitives/test_cmac.py')
-rw-r--r-- | tests/hazmat/primitives/test_cmac.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/hazmat/primitives/test_cmac.py b/tests/hazmat/primitives/test_cmac.py index c007527f..c778ebee 100644 --- a/tests/hazmat/primitives/test_cmac.py +++ b/tests/hazmat/primitives/test_cmac.py @@ -21,7 +21,6 @@ import pytest import six -from cryptography import utils from cryptography.exceptions import ( AlreadyFinalized, InvalidSignature, _Reasons ) @@ -31,6 +30,7 @@ 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 ) @@ -195,18 +195,14 @@ class TestCMAC(object): def test_copy(): - @utils.register_interface(CMACBackend) - class PretendBackend(object): - pass - - pretend_backend = PretendBackend() + backend = DummyCMACBackend([AES]) copied_ctx = pretend.stub() pretend_ctx = pretend.stub(copy=lambda: copied_ctx) key = b"2b7e151628aed2a6abf7158809cf4f3c" - cmac = CMAC(AES(key), backend=pretend_backend, ctx=pretend_ctx) + cmac = CMAC(AES(key), backend=backend, ctx=pretend_ctx) - assert cmac._backend is pretend_backend - assert cmac.copy()._backend is pretend_backend + assert cmac._backend is backend + assert cmac.copy()._backend is backend def test_invalid_backend(): |