aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/bindings
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2013-11-15 16:19:50 -0800
committerDavid Reid <dreid@dreid.org>2013-11-15 16:19:50 -0800
commit0a394df31c4165d0230843ebea2717b3cd3caafa (patch)
tree5c674a900d0f7465cde2796b9bba21a87d67b56e /tests/hazmat/bindings
parent9489c769dbd7ea7c6830b5fcd70095818452e607 (diff)
downloadcryptography-0a394df31c4165d0230843ebea2717b3cd3caafa.tar.gz
cryptography-0a394df31c4165d0230843ebea2717b3cd3caafa.tar.bz2
cryptography-0a394df31c4165d0230843ebea2717b3cd3caafa.zip
Implement and document an interface for cipher algorithms
Diffstat (limited to 'tests/hazmat/bindings')
-rw-r--r--tests/hazmat/bindings/test_openssl.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py
index 241c6411..e4f8dd8b 100644
--- a/tests/hazmat/bindings/test_openssl.py
+++ b/tests/hazmat/bindings/test_openssl.py
@@ -15,16 +15,18 @@ import pytest
from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.bindings.openssl.backend import backend, Backend
+from cryptography.hazmat.primitives import interfaces
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.ciphers.modes import CBC
-class FakeMode(object):
+class DummyMode(object):
pass
-class FakeCipher(object):
+@interfaces.register(interfaces.CipherAlgorithm)
+class DummyCipher(object):
pass
@@ -58,12 +60,12 @@ class TestOpenSSL(object):
def test_nonexistent_cipher(self):
b = Backend()
b.register_cipher_adapter(
- FakeCipher,
- FakeMode,
+ DummyCipher,
+ DummyMode,
lambda backend, cipher, mode: backend.ffi.NULL
)
cipher = Cipher(
- FakeCipher(), FakeMode(), backend=b,
+ DummyCipher(), DummyMode(), backend=b,
)
with pytest.raises(UnsupportedAlgorithm):
cipher.encryptor()