aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-01-30 15:42:37 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2014-01-30 15:42:37 -0800
commitebc5161f606fe1ac7d51b6ab997f663cfcf9be9b (patch)
tree833540b1b45ec859e48e62efb3b1449bab63a1d0 /tests
parent0929f8ff07e71410bd2ce89d407805bd476c1761 (diff)
downloadcryptography-ebc5161f606fe1ac7d51b6ab997f663cfcf9be9b.tar.gz
cryptography-ebc5161f606fe1ac7d51b6ab997f663cfcf9be9b.tar.bz2
cryptography-ebc5161f606fe1ac7d51b6ab997f663cfcf9be9b.zip
Fix
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/backends/test_multibackend.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py
index 03b3187b..127c0d3e 100644
--- a/tests/hazmat/backends/test_multibackend.py
+++ b/tests/hazmat/backends/test_multibackend.py
@@ -13,13 +13,17 @@
import pytest
+from cryptography import utils
from cryptography.exceptions import UnsupportedAlgorithm
+from cryptography.hazmat.backends.interfaces import (
+ CipherBackend, HashBackend, HMACBackend, PBKDF2HMACBackend
+)
from cryptography.hazmat.backends.multibackend import PrioritizedMultiBackend
from cryptography.hazmat.primitives import hashes, hmac
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
-from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
+@utils.register_interface(CipherBackend)
class DummyCipherBackend(object):
def __init__(self, supported_ciphers):
self._ciphers = supported_ciphers
@@ -36,6 +40,7 @@ class DummyCipherBackend(object):
raise UnsupportedAlgorithm
+@utils.register_interface(HashBackend)
class DummyHashBackend(object):
def __init__(self, supported_algorithms):
self._algorithms = supported_algorithms
@@ -48,6 +53,7 @@ class DummyHashBackend(object):
raise UnsupportedAlgorithm
+@utils.register_interface(HMACBackend)
class DummyHMACBackend(object):
def __init__(self, supported_algorithms):
self._algorithms = supported_algorithms
@@ -60,6 +66,7 @@ class DummyHMACBackend(object):
raise UnsupportedAlgorithm
+@utils.register_interface(PBKDF2HMACBackend)
class DummyPBKDF2HMAC(object):
def __init__(self, supported_algorithms):
self._algorithms = supported_algorithms
@@ -77,6 +84,7 @@ class DummyPBKDF2HMAC(object):
class TestPrioritizedMultiBackend(object):
def test_ciphers(self):
backend = PrioritizedMultiBackend([
+ DummyHashBackend([]),
DummyCipherBackend([
(algorithms.AES, modes.CBC),
])