diff options
Diffstat (limited to 'tests/hazmat/primitives/test_pbkdf2hmac.py')
-rw-r--r-- | tests/hazmat/primitives/test_pbkdf2hmac.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/hazmat/primitives/test_pbkdf2hmac.py b/tests/hazmat/primitives/test_pbkdf2hmac.py index ebc5fbf5..62ca0921 100644 --- a/tests/hazmat/primitives/test_pbkdf2hmac.py +++ b/tests/hazmat/primitives/test_pbkdf2hmac.py @@ -18,12 +18,14 @@ import six from cryptography import utils from cryptography.exceptions import ( - AlreadyFinalized, InvalidKey, UnsupportedAlgorithm + AlreadyFinalized, InvalidKey, _Reasons ) from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes, interfaces from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC +from ...utils import raises_unsupported_algorithm + @utils.register_interface(interfaces.HashAlgorithm) class DummyHash(object): @@ -48,7 +50,7 @@ class TestPBKDF2HMAC(object): kdf.verify(b"password", key) def test_unsupported_algorithm(self): - with pytest.raises(UnsupportedAlgorithm): + with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_HASH): PBKDF2HMAC(DummyHash(), 20, b"salt", 10, default_backend()) def test_invalid_key(self): @@ -72,5 +74,5 @@ class TestPBKDF2HMAC(object): def test_invalid_backend(): pretend_backend = object() - with pytest.raises(UnsupportedAlgorithm): + with raises_unsupported_algorithm(_Reasons.BACKEND_MISSING_INTERFACE): PBKDF2HMAC(hashes.SHA1(), 20, b"salt", 10, pretend_backend) |