aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2013-12-21 16:29:45 +0000
committerAlex Stapleton <alexs@prol.etari.at>2013-12-22 10:48:01 +0000
commit35cb3659bcf97eea22ce1ad14b7fc3d0913d2be2 (patch)
tree925805d60b56e0be6da8777de550c73c25f97d65 /tests/hazmat/backends
parent9b9318d79ba5927603b120411d13b607938cae56 (diff)
downloadcryptography-35cb3659bcf97eea22ce1ad14b7fc3d0913d2be2.tar.gz
cryptography-35cb3659bcf97eea22ce1ad14b7fc3d0913d2be2.tar.bz2
cryptography-35cb3659bcf97eea22ce1ad14b7fc3d0913d2be2.zip
UnsupportedAlgorithm error messages for Ciphers
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r--tests/hazmat/backends/test_openssl.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index 962959b9..543a05fe 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -23,13 +23,14 @@ from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.ciphers.modes import CBC
+@utils.register_interface(interfaces.Mode)
class DummyMode(object):
- pass
+ name = "dummy-mode"
@utils.register_interface(interfaces.CipherAlgorithm)
class DummyCipher(object):
- pass
+ name = "dummy-cipher"
class TestOpenSSL(object):
@@ -62,15 +63,16 @@ class TestOpenSSL(object):
assert b.ffi is backend.ffi
assert b.lib is backend.lib
- def test_nonexistent_cipher(self):
+ @pytest.mark.parametrize("mode", [DummyMode(), None])
+ def test_nonexistent_cipher(self, mode):
b = Backend()
b.register_cipher_adapter(
DummyCipher,
- DummyMode,
+ type(mode),
lambda backend, cipher, mode: backend.ffi.NULL
)
cipher = Cipher(
- DummyCipher(), DummyMode(), backend=b,
+ DummyCipher(), mode, backend=b,
)
with pytest.raises(UnsupportedAlgorithm):
cipher.encryptor()