From 621635712962267e589b19fb2292a764e5ad71de Mon Sep 17 00:00:00 2001 From: Alex Stapleton Date: Tue, 1 Apr 2014 12:02:02 +0100 Subject: Add _Reasons.UNSUPPORTED_MGF --- tests/hazmat/primitives/test_rsa.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index 5d94e790..32f54945 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -630,7 +630,7 @@ class TestRSASignature(object): key_size=512, backend=backend ) - with pytest.raises(UnsupportedAlgorithm): + with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_MGF): private_key.signer(padding.PSS(mgf=DummyMGF()), hashes.SHA1(), backend) @@ -881,7 +881,7 @@ class TestRSAVerification(object): backend=backend ) public_key = private_key.public_key() - with pytest.raises(UnsupportedAlgorithm): + with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_MGF): public_key.verifier(b"sig", padding.PSS(mgf=DummyMGF()), hashes.SHA1(), backend) -- cgit v1.2.3 From 976945d4078bcd16eb5a95526e6b26ace7b19bd3 Mon Sep 17 00:00:00 2001 From: Alex Stapleton Date: Tue, 1 Apr 2014 12:04:44 +0100 Subject: Add _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM --- tests/hazmat/backends/test_multibackend.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py index b7bcaf69..c91cb471 100644 --- a/tests/hazmat/backends/test_multibackend.py +++ b/tests/hazmat/backends/test_multibackend.py @@ -179,13 +179,19 @@ class TestMultiBackend(object): padding.PKCS1v15(), hashes.MD5()) backend = MultiBackend([]) - with pytest.raises(UnsupportedAlgorithm): + with raises_unsupported_algorithm( + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM + ): backend.generate_rsa_private_key(key_size=1024, public_exponent=3) - with pytest.raises(UnsupportedAlgorithm): + with raises_unsupported_algorithm( + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM + ): backend.create_rsa_signature_ctx("private_key", padding.PKCS1v15(), hashes.MD5()) - with pytest.raises(UnsupportedAlgorithm): + with raises_unsupported_algorithm( + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM + ): backend.create_rsa_verification_ctx( "public_key", "sig", padding.PKCS1v15(), hashes.MD5()) -- cgit v1.2.3 From df16f4a573d0d9a81236818c79032f4c12ffec00 Mon Sep 17 00:00:00 2001 From: Alex Stapleton Date: Tue, 1 Apr 2014 15:00:00 +0100 Subject: fix pep8 errors --- tests/hazmat/backends/test_multibackend.py | 2 -- tests/hazmat/primitives/test_rsa.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py index c91cb471..f0be72b2 100644 --- a/tests/hazmat/backends/test_multibackend.py +++ b/tests/hazmat/backends/test_multibackend.py @@ -13,8 +13,6 @@ from __future__ import absolute_import, division, print_function -import pytest - from cryptography import utils from cryptography.exceptions import ( UnsupportedAlgorithm, _Reasons diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index 32f54945..c458a662 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -22,7 +22,7 @@ import os import pytest from cryptography import exceptions, utils -from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.exceptions import _Reasons from cryptography.hazmat.primitives import hashes, interfaces from cryptography.hazmat.primitives.asymmetric import padding, rsa -- cgit v1.2.3