aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-10-28 07:48:38 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-10-28 07:48:38 -0700
commit91d0ba1380c27e8a6b62be18e76536000d7006ea (patch)
treea4b22d30963e82636bb4703067d3b46c26add37c /tests
parent198bb65302f710957a5f67d53389277c5ab0a58c (diff)
parent4365b12f01b3f5f501ca4f86c59999e78980790c (diff)
downloadcryptography-91d0ba1380c27e8a6b62be18e76536000d7006ea.tar.gz
cryptography-91d0ba1380c27e8a6b62be18e76536000d7006ea.tar.bz2
cryptography-91d0ba1380c27e8a6b62be18e76536000d7006ea.zip
Merge branch 'master' into verify-interfaces
Conflicts: tests/hazmat/backends/test_commoncrypto.py tests/hazmat/backends/test_openssl.py tests/hazmat/primitives/test_block.py tests/hazmat/primitives/test_hashes.py tests/hazmat/primitives/test_hmac.py tests/hazmat/primitives/test_pbkdf2hmac.py
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py15
-rw-r--r--tests/hazmat/backends/test_commoncrypto.py2
-rw-r--r--tests/hazmat/backends/test_openssl.py6
-rw-r--r--tests/hazmat/primitives/test_block.py2
-rw-r--r--tests/hazmat/primitives/test_hashes.py4
-rw-r--r--tests/hazmat/primitives/test_hmac.py4
-rw-r--r--tests/hazmat/primitives/test_pbkdf2hmac.py4
7 files changed, 16 insertions, 21 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 9dc37d38..27cf13b0 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -27,17 +27,12 @@ def pytest_generate_tests(metafunc):
if "backend" in metafunc.fixturenames:
filtered_backends = []
for backend in selected_backends:
- try:
- required = metafunc.function.requires_backend_interface
- except AttributeError:
- # function does not have requires_backend_interface decorator
+ required = metafunc.function.requires_backend_interface
+ required_interfaces = tuple(
+ mark.kwargs["interface"] for mark in required
+ )
+ if isinstance(backend, required_interfaces):
filtered_backends.append(backend)
- else:
- required_interfaces = tuple(
- mark.kwargs["interface"] for mark in required
- )
- if isinstance(backend, required_interfaces):
- filtered_backends.append(backend)
# If you pass an empty list to parametrize Bad Things(tm) happen
# as of pytest 2.6.4 when the test also has a parametrize decorator
diff --git a/tests/hazmat/backends/test_commoncrypto.py b/tests/hazmat/backends/test_commoncrypto.py
index b79c02e0..6bb0ede0 100644
--- a/tests/hazmat/backends/test_commoncrypto.py
+++ b/tests/hazmat/backends/test_commoncrypto.py
@@ -30,7 +30,7 @@ from ...utils import raises_unsupported_algorithm
class DummyCipher(object):
name = "dummy-cipher"
block_size = 128
- key_size = 128
+ digest_size = None
@pytest.mark.skipif("commoncrypto" not in
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index 65113f1a..ebd8686c 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -52,7 +52,7 @@ class DummyMode(object):
@utils.register_interface(interfaces.CipherAlgorithm)
class DummyCipher(object):
name = "dummy-cipher"
- key_size = 128
+ key_size = None
@utils.register_interface(interfaces.AsymmetricPadding)
@@ -63,8 +63,8 @@ class DummyPadding(object):
@utils.register_interface(interfaces.HashAlgorithm)
class DummyHash(object):
name = "dummy-hash"
- block_size = 128
- digest_size = 128
+ block_size = None
+ digest_size = None
class DummyMGF(object):
diff --git a/tests/hazmat/primitives/test_block.py b/tests/hazmat/primitives/test_block.py
index 53b87341..14f76758 100644
--- a/tests/hazmat/primitives/test_block.py
+++ b/tests/hazmat/primitives/test_block.py
@@ -44,7 +44,7 @@ class DummyMode(object):
@utils.register_interface(interfaces.CipherAlgorithm)
class DummyCipher(object):
name = "dummy-cipher"
- key_size = 128
+ key_size = None
@pytest.mark.requires_backend_interface(interface=CipherBackend)
diff --git a/tests/hazmat/primitives/test_hashes.py b/tests/hazmat/primitives/test_hashes.py
index bab5bfca..4345a7f4 100644
--- a/tests/hazmat/primitives/test_hashes.py
+++ b/tests/hazmat/primitives/test_hashes.py
@@ -34,8 +34,8 @@ from ...utils import raises_unsupported_algorithm
@utils.register_interface(interfaces.HashAlgorithm)
class UnsupportedDummyHash(object):
name = "unsupported-dummy-hash"
- block_size = 128
- digest_size = 128
+ block_size = None
+ digest_size = None
@pytest.mark.requires_backend_interface(interface=HashBackend)
diff --git a/tests/hazmat/primitives/test_hmac.py b/tests/hazmat/primitives/test_hmac.py
index 01b1cdcb..3553632c 100644
--- a/tests/hazmat/primitives/test_hmac.py
+++ b/tests/hazmat/primitives/test_hmac.py
@@ -33,8 +33,8 @@ from ...utils import raises_unsupported_algorithm
@utils.register_interface(interfaces.HashAlgorithm)
class UnsupportedDummyHash(object):
name = "unsupported-dummy-hash"
- block_size = 128
- digest_size = 128
+ block_size = None
+ digest_size = None
@pytest.mark.supported(
diff --git a/tests/hazmat/primitives/test_pbkdf2hmac.py b/tests/hazmat/primitives/test_pbkdf2hmac.py
index fa925877..c140c14d 100644
--- a/tests/hazmat/primitives/test_pbkdf2hmac.py
+++ b/tests/hazmat/primitives/test_pbkdf2hmac.py
@@ -31,8 +31,8 @@ from ...utils import raises_unsupported_algorithm
@utils.register_interface(interfaces.HashAlgorithm)
class DummyHash(object):
name = "dummy-hash"
- block_size = 128
- digest_size = 128
+ block_size = None
+ digest_size = None
class TestPBKDF2HMAC(object):