diff options
Diffstat (limited to 'tests/hazmat/primitives/test_hkdf.py')
-rw-r--r-- | tests/hazmat/primitives/test_hkdf.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/hazmat/primitives/test_hkdf.py b/tests/hazmat/primitives/test_hkdf.py index e3e2a9df..2e3c0c3d 100644 --- a/tests/hazmat/primitives/test_hkdf.py +++ b/tests/hazmat/primitives/test_hkdf.py @@ -13,14 +13,18 @@ from __future__ import absolute_import, division, print_function -import six - import pytest -from cryptography.exceptions import AlreadyFinalized, InvalidKey +import six + +from cryptography.exceptions import ( + AlreadyFinalized, InvalidKey, _Reasons +) from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.kdf.hkdf import HKDF +from ...utils import raises_unsupported_algorithm + @pytest.mark.hmac class TestHKDF(object): @@ -145,3 +149,10 @@ class TestHKDF(object): ) hkdf.verify(b"foo", six.u("bar")) + + +def test_invalid_backend(): + pretend_backend = object() + + with raises_unsupported_algorithm(_Reasons.BACKEND_MISSING_INTERFACE): + HKDF(hashes.SHA256(), 16, None, None, pretend_backend) |