aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends/test_openssl.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-01-01 08:11:13 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2014-01-01 08:11:13 -0800
commit2a160d6a159817dd9d08a84e77d102e328f9af4f (patch)
tree461b7c607367f243bb46996ec16ad7424e48d440 /tests/hazmat/backends/test_openssl.py
parent62aefffb1396190930074bf04c91459d1536bd0e (diff)
parent522487e5a7dd3004747da85c9f6c53fc5dc4de06 (diff)
downloadcryptography-2a160d6a159817dd9d08a84e77d102e328f9af4f.tar.gz
cryptography-2a160d6a159817dd9d08a84e77d102e328f9af4f.tar.bz2
cryptography-2a160d6a159817dd9d08a84e77d102e328f9af4f.zip
Merge branch 'master' into validate-iv
Conflicts: tests/hazmat/backends/test_openssl.py tests/hazmat/primitives/test_block.py
Diffstat (limited to 'tests/hazmat/backends/test_openssl.py')
-rw-r--r--tests/hazmat/backends/test_openssl.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index 9c8fea2a..23f9bff1 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -23,14 +23,17 @@ from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.ciphers.modes import CBC
+@utils.register_interface(interfaces.Mode)
class DummyMode(object):
+ name = "dummy-mode"
+
def validate_for_algorithm(self, algorithm):
pass
@utils.register_interface(interfaces.CipherAlgorithm)
class DummyCipher(object):
- pass
+ name = "dummy-cipher"
class TestOpenSSL(object):
@@ -63,15 +66,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()