aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends/test_openssl.py
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2014-03-26 20:26:49 +0000
committerAlex Stapleton <alexs@prol.etari.at>2014-03-27 12:53:55 +0000
commit4c1401a3745af97fcd398ff5b7f0dcb94f5292a0 (patch)
tree5e9a953a04398bea99b95e07044eb917c28f56b3 /tests/hazmat/backends/test_openssl.py
parentf33ccfcc8e611359a65235d72423fc9c62b438da (diff)
downloadcryptography-4c1401a3745af97fcd398ff5b7f0dcb94f5292a0.tar.gz
cryptography-4c1401a3745af97fcd398ff5b7f0dcb94f5292a0.tar.bz2
cryptography-4c1401a3745af97fcd398ff5b7f0dcb94f5292a0.zip
Update tests and raise sites
Diffstat (limited to 'tests/hazmat/backends/test_openssl.py')
-rw-r--r--tests/hazmat/backends/test_openssl.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index fdc661f0..016da0fc 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -16,7 +16,9 @@ from __future__ import absolute_import, division, print_function
import pytest
from cryptography import utils
-from cryptography.exceptions import InternalError, UnsupportedAlgorithm
+from cryptography.exceptions import (
+ InternalError, _Reasons
+)
from cryptography.hazmat.backends.openssl.backend import Backend, backend
from cryptography.hazmat.primitives import hashes, interfaces
from cryptography.hazmat.primitives.asymmetric import padding, rsa
@@ -24,6 +26,8 @@ from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.ciphers.modes import CBC
+from ...utils import raises_unsupported_algorithm
+
@utils.register_interface(interfaces.Mode)
class DummyMode(object):
@@ -76,7 +80,7 @@ class TestOpenSSL(object):
cipher = Cipher(
DummyCipher(), mode, backend=b,
)
- with pytest.raises(UnsupportedAlgorithm):
+ with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_CIPHER):
cipher.encryptor()
def test_consume_errors(self):
@@ -138,7 +142,7 @@ class TestOpenSSL(object):
def test_derive_pbkdf2_raises_unsupported_on_old_openssl(self):
if backend.pbkdf2_hmac_supported(hashes.SHA256()):
pytest.skip("Requires an older OpenSSL")
- with pytest.raises(UnsupportedAlgorithm):
+ with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_HASH):
backend.derive_pbkdf2_hmac(hashes.SHA256(), 10, b"", 1000, b"")
@pytest.mark.skipif(
@@ -151,7 +155,7 @@ class TestOpenSSL(object):
key_size=512,
backend=backend
)
- with pytest.raises(UnsupportedAlgorithm):
+ with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_HASH):
private_key.signer(
padding.PSS(
mgf=padding.MGF1(
@@ -163,7 +167,7 @@ class TestOpenSSL(object):
backend
)
public_key = private_key.public_key()
- with pytest.raises(UnsupportedAlgorithm):
+ with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_HASH):
public_key.verifier(
b"sig",
padding.PSS(