aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-07-20 13:04:25 +0200
committerAlex Gaynor <alex.gaynor@gmail.com>2017-07-20 07:04:25 -0400
commit0d6aaf49c1890378ce7ecf741a3a40c859d3b9fb (patch)
tree2474a443821ba4b1fb7d9f7018aba278865b7669 /tests/hazmat/primitives
parentd3c4ba3a790883be17ca0a4e7ae291d261771700 (diff)
downloadcryptography-0d6aaf49c1890378ce7ecf741a3a40c859d3b9fb.tar.gz
cryptography-0d6aaf49c1890378ce7ecf741a3a40c859d3b9fb.tar.bz2
cryptography-0d6aaf49c1890378ce7ecf741a3a40c859d3b9fb.zip
remove deprecated items (#3794)
* remove deprecated items whirlpool, ripemd160, unsupportedextension, and the old interfaces * flake8 and remove a test generator we no longe use * make it clear we warned you about these things
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r--tests/hazmat/primitives/test_hash_vectors.py46
-rw-r--r--tests/hazmat/primitives/test_hashes.py26
-rw-r--r--tests/hazmat/primitives/test_hmac_vectors.py16
-rw-r--r--tests/hazmat/primitives/test_mac.py15
-rw-r--r--tests/hazmat/primitives/utils.py12
5 files changed, 1 insertions, 114 deletions
diff --git a/tests/hazmat/primitives/test_hash_vectors.py b/tests/hazmat/primitives/test_hash_vectors.py
index 8757df24..2db9e906 100644
--- a/tests/hazmat/primitives/test_hash_vectors.py
+++ b/tests/hazmat/primitives/test_hash_vectors.py
@@ -11,7 +11,7 @@ import pytest
from cryptography.hazmat.backends.interfaces import HashBackend
from cryptography.hazmat.primitives import hashes
-from .utils import generate_hash_test, generate_long_string_hash_test
+from .utils import generate_hash_test
from ...utils import load_hash_vectors
@@ -101,50 +101,6 @@ class TestSHA512(object):
@pytest.mark.supported(
- only_if=lambda backend: backend.hash_supported(hashes.RIPEMD160()),
- skip_message="Does not support RIPEMD160",
-)
-@pytest.mark.requires_backend_interface(interface=HashBackend)
-class TestRIPEMD160(object):
- test_RIPEMD160 = generate_hash_test(
- load_hash_vectors,
- os.path.join("hashes", "ripemd160"),
- [
- "ripevectors.txt",
- ],
- hashes.RIPEMD160(),
- )
-
- test_RIPEMD160_long_string = generate_long_string_hash_test(
- hashes.RIPEMD160(),
- "52783243c1697bdbe16d37f97f68f08325dc1528",
- )
-
-
-@pytest.mark.supported(
- only_if=lambda backend: backend.hash_supported(hashes.Whirlpool()),
- skip_message="Does not support Whirlpool",
-)
-@pytest.mark.requires_backend_interface(interface=HashBackend)
-class TestWhirlpool(object):
- test_whirlpool = generate_hash_test(
- load_hash_vectors,
- os.path.join("hashes", "whirlpool"),
- [
- "iso-test-vectors.txt",
- ],
- hashes.Whirlpool(),
- )
-
- test_whirlpool_long_string = generate_long_string_hash_test(
- hashes.Whirlpool(),
- ("0c99005beb57eff50a7cf005560ddf5d29057fd86b2"
- "0bfd62deca0f1ccea4af51fc15490eddc47af32bb2b"
- "66c34ff9ad8c6008ad677f77126953b226e4ed8b01"),
- )
-
-
-@pytest.mark.supported(
only_if=lambda backend: backend.hash_supported(hashes.MD5()),
skip_message="Does not support MD5",
)
diff --git a/tests/hazmat/primitives/test_hashes.py b/tests/hazmat/primitives/test_hashes.py
index 0e817666..60950aed 100644
--- a/tests/hazmat/primitives/test_hashes.py
+++ b/tests/hazmat/primitives/test_hashes.py
@@ -110,32 +110,6 @@ class TestSHA512(object):
@pytest.mark.supported(
- only_if=lambda backend: backend.hash_supported(hashes.RIPEMD160()),
- skip_message="Does not support RIPEMD160",
-)
-@pytest.mark.requires_backend_interface(interface=HashBackend)
-class TestRIPEMD160(object):
- test_RIPEMD160 = generate_base_hash_test(
- hashes.RIPEMD160(),
- digest_size=20,
- block_size=64,
- )
-
-
-@pytest.mark.supported(
- only_if=lambda backend: backend.hash_supported(hashes.Whirlpool()),
- skip_message="Does not support Whirlpool",
-)
-@pytest.mark.requires_backend_interface(interface=HashBackend)
-class TestWhirlpool(object):
- test_Whirlpool = generate_base_hash_test(
- hashes.Whirlpool(),
- digest_size=64,
- block_size=64,
- )
-
-
-@pytest.mark.supported(
only_if=lambda backend: backend.hash_supported(hashes.MD5()),
skip_message="Does not support MD5",
)
diff --git a/tests/hazmat/primitives/test_hmac_vectors.py b/tests/hazmat/primitives/test_hmac_vectors.py
index 8704e724..70c929ad 100644
--- a/tests/hazmat/primitives/test_hmac_vectors.py
+++ b/tests/hazmat/primitives/test_hmac_vectors.py
@@ -107,19 +107,3 @@ class TestHMACSHA512(object):
],
hashes.SHA512(),
)
-
-
-@pytest.mark.supported(
- only_if=lambda backend: backend.hmac_supported(hashes.RIPEMD160()),
- skip_message="Does not support RIPEMD160",
-)
-@pytest.mark.requires_backend_interface(interface=HMACBackend)
-class TestHMACRIPEMD160(object):
- test_hmac_ripemd160 = generate_hmac_test(
- load_hash_vectors,
- "HMAC",
- [
- "rfc-2286-ripemd160.txt",
- ],
- hashes.RIPEMD160(),
- )
diff --git a/tests/hazmat/primitives/test_mac.py b/tests/hazmat/primitives/test_mac.py
deleted file mode 100644
index 7263212a..00000000
--- a/tests/hazmat/primitives/test_mac.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-
-from __future__ import absolute_import, division, print_function
-
-import pytest
-
-from cryptography import utils
-
-
-def test_deprecated_maccontext():
- with pytest.warns(utils.DeprecatedIn19):
- from cryptography.hazmat.primitives.interfaces import MACContext
- assert MACContext
diff --git a/tests/hazmat/primitives/utils.py b/tests/hazmat/primitives/utils.py
index b8200123..16a26819 100644
--- a/tests/hazmat/primitives/utils.py
+++ b/tests/hazmat/primitives/utils.py
@@ -189,18 +189,6 @@ def base_hash_test(backend, algorithm, digest_size, block_size):
assert copy.finalize() == m.finalize()
-def generate_long_string_hash_test(hash_factory, md):
- def test_long_string_hash(self, backend):
- long_string_hash_test(backend, hash_factory, md)
- return test_long_string_hash
-
-
-def long_string_hash_test(backend, algorithm, md):
- m = hashes.Hash(algorithm, backend=backend)
- m.update(b"a" * 1000000)
- assert m.finalize() == binascii.unhexlify(md.lower().encode("ascii"))
-
-
def generate_base_hmac_test(hash_cls):
def test_base_hmac(self, backend):
base_hmac_test(backend, hash_cls)