aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_3des.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-12-27 16:16:41 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-12-27 16:16:41 -0800
commit7ede6a4b80677bf56088b8492fa87b19183db448 (patch)
treea779758c943ba22310b8ba3bd7b3202446417503 /tests/hazmat/primitives/test_3des.py
parent9b51cc1a843d6a8427eb4ad49aeaf5317c442fed (diff)
parentb078d8e1f446a1d2d13453e65e37fbaf4f6b17f2 (diff)
downloadcryptography-7ede6a4b80677bf56088b8492fa87b19183db448.tar.gz
cryptography-7ede6a4b80677bf56088b8492fa87b19183db448.tar.bz2
cryptography-7ede6a4b80677bf56088b8492fa87b19183db448.zip
Merge pull request #353 from reaperhulk/supported-mark
Add mark that allows us to do skip tests on backends via decorators
Diffstat (limited to 'tests/hazmat/primitives/test_3des.py')
-rw-r--r--tests/hazmat/primitives/test_3des.py42
1 files changed, 18 insertions, 24 deletions
diff --git a/tests/hazmat/primitives/test_3des.py b/tests/hazmat/primitives/test_3des.py
index 439ca258..581c47eb 100644
--- a/tests/hazmat/primitives/test_3des.py
+++ b/tests/hazmat/primitives/test_3des.py
@@ -28,6 +28,12 @@ from .utils import generate_encrypt_test
from ...utils import load_nist_vectors
+@pytest.mark.supported(
+ only_if=lambda backend: backend.cipher_supported(
+ algorithms.TripleDES("\x00" * 8), modes.CBC("\x00" * 8)
+ ),
+ skip_message="Does not support TripleDES CBC",
+)
@pytest.mark.cipher
class TestTripleDES_CBC(object):
test_KAT = generate_encrypt_test(
@@ -42,10 +48,6 @@ class TestTripleDES_CBC(object):
],
lambda keys, **kwargs: algorithms.TripleDES(binascii.unhexlify(keys)),
lambda iv, **kwargs: modes.CBC(binascii.unhexlify(iv)),
- only_if=lambda backend: backend.cipher_supported(
- algorithms.TripleDES("\x00" * 8), modes.CBC("\x00" * 8)
- ),
- skip_message="Does not support TripleDES CBC",
)
test_MMT = generate_encrypt_test(
@@ -60,13 +62,15 @@ class TestTripleDES_CBC(object):
binascii.unhexlify(key1 + key2 + key3)
),
lambda iv, **kwargs: modes.CBC(binascii.unhexlify(iv)),
- only_if=lambda backend: backend.cipher_supported(
- algorithms.TripleDES("\x00" * 8), modes.CBC("\x00" * 8)
- ),
- skip_message="Does not support TripleDES CBC",
)
+@pytest.mark.supported(
+ only_if=lambda backend: backend.cipher_supported(
+ algorithms.TripleDES("\x00" * 8), modes.OFB("\x00" * 8)
+ ),
+ skip_message="Does not support TripleDES OFB",
+)
@pytest.mark.cipher
class TestTripleDES_OFB(object):
test_KAT = generate_encrypt_test(
@@ -81,10 +85,6 @@ class TestTripleDES_OFB(object):
],
lambda keys, **kwargs: algorithms.TripleDES(binascii.unhexlify(keys)),
lambda iv, **kwargs: modes.OFB(binascii.unhexlify(iv)),
- only_if=lambda backend: backend.cipher_supported(
- algorithms.TripleDES("\x00" * 8), modes.OFB("\x00" * 8)
- ),
- skip_message="Does not support TripleDES OFB",
)
test_MMT = generate_encrypt_test(
@@ -99,13 +99,15 @@ class TestTripleDES_OFB(object):
binascii.unhexlify(key1 + key2 + key3)
),
lambda iv, **kwargs: modes.OFB(binascii.unhexlify(iv)),
- only_if=lambda backend: backend.cipher_supported(
- algorithms.TripleDES("\x00" * 8), modes.OFB("\x00" * 8)
- ),
- skip_message="Does not support TripleDES OFB",
)
+@pytest.mark.supported(
+ only_if=lambda backend: backend.cipher_supported(
+ algorithms.TripleDES("\x00" * 8), modes.CFB("\x00" * 8)
+ ),
+ skip_message="Does not support TripleDES CFB",
+)
@pytest.mark.cipher
class TestTripleDES_CFB(object):
test_KAT = generate_encrypt_test(
@@ -120,10 +122,6 @@ class TestTripleDES_CFB(object):
],
lambda keys, **kwargs: algorithms.TripleDES(binascii.unhexlify(keys)),
lambda iv, **kwargs: modes.CFB(binascii.unhexlify(iv)),
- only_if=lambda backend: backend.cipher_supported(
- algorithms.TripleDES("\x00" * 8), modes.CFB("\x00" * 8)
- ),
- skip_message="Does not support TripleDES CFB",
)
test_MMT = generate_encrypt_test(
@@ -138,8 +136,4 @@ class TestTripleDES_CFB(object):
binascii.unhexlify(key1 + key2 + key3)
),
lambda iv, **kwargs: modes.CFB(binascii.unhexlify(iv)),
- only_if=lambda backend: backend.cipher_supported(
- algorithms.TripleDES("\x00" * 8), modes.CFB("\x00" * 8)
- ),
- skip_message="Does not support TripleDES CFB",
)