From 0a394df31c4165d0230843ebea2717b3cd3caafa Mon Sep 17 00:00:00 2001 From: David Reid Date: Fri, 15 Nov 2013 16:19:50 -0800 Subject: Implement and document an interface for cipher algorithms --- tests/hazmat/bindings/test_openssl.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'tests/hazmat/bindings') 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() -- cgit v1.2.3