diff options
author | Julian Krause <julian.krause@gmail.com> | 2013-12-25 12:58:40 -0800 |
---|---|---|
committer | Julian Krause <julian.krause@gmail.com> | 2013-12-25 12:58:40 -0800 |
commit | e62760af74ebb8b08d7670dfaff177cdeb679f0f (patch) | |
tree | 70e51d6aadff7d1ec204793b12de221610204254 /tests/hazmat/backends | |
parent | c91fe6a21fbae3107de7b2e53b7343cd67ac8c6d (diff) | |
parent | 0865a8b81075bfe073aba56e03cc57c30bfffe00 (diff) | |
download | cryptography-e62760af74ebb8b08d7670dfaff177cdeb679f0f.tar.gz cryptography-e62760af74ebb8b08d7670dfaff177cdeb679f0f.tar.bz2 cryptography-e62760af74ebb8b08d7670dfaff177cdeb679f0f.zip |
Merge branch 'master' of https://github.com/pyca/cryptography into verify
Conflicts:
tests/hazmat/primitives/test_hashes.py
tests/hazmat/primitives/test_hmac.py
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r-- | tests/hazmat/backends/test_openssl.py | 12 |
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() |