aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_pbkdf2hmac.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-03-27 11:04:21 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-03-27 11:04:21 -0700
commit3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8 (patch)
tree8285f420269fd636e63c9152143750922e48e869 /tests/hazmat/primitives/test_pbkdf2hmac.py
parent844c14a15884fb60871640576e30a61e6c4c2db1 (diff)
parent85a791f0fa061ec644f5bfca41ee6038eeef38eb (diff)
downloadcryptography-3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8.tar.gz
cryptography-3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8.tar.bz2
cryptography-3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8.zip
Merge pull request #849 from public/changeup-exceptions-2-electric-boogaloo
Use a single tagged exception instead of a hierarchy
Diffstat (limited to 'tests/hazmat/primitives/test_pbkdf2hmac.py')
-rw-r--r--tests/hazmat/primitives/test_pbkdf2hmac.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/hazmat/primitives/test_pbkdf2hmac.py b/tests/hazmat/primitives/test_pbkdf2hmac.py
index 585693ea..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, UnsupportedHash, UnsupportedInterface
+ 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(UnsupportedHash):
+ 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(UnsupportedInterface):
+ with raises_unsupported_algorithm(_Reasons.BACKEND_MISSING_INTERFACE):
PBKDF2HMAC(hashes.SHA1(), 20, b"salt", 10, pretend_backend)