diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2017-11-10 23:19:05 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-11-11 12:19:05 +0800 |
commit | 270933c1a2afa0aa60409946bb7319d85fd60059 (patch) | |
tree | f5ff261a2dd5be46e812785d67f9322596b19792 /tests/hazmat/primitives/test_rsa.py | |
parent | d2d800058f93f78e46afe504b5709b865b7af35d (diff) | |
download | cryptography-270933c1a2afa0aa60409946bb7319d85fd60059.tar.gz cryptography-270933c1a2afa0aa60409946bb7319d85fd60059.tar.bz2 cryptography-270933c1a2afa0aa60409946bb7319d85fd60059.zip |
Use a different warning class so users get warnings (#4014)
* Use a different warning class so users get warnings
* fixed tests
* do our own warning class
* typo
* flake8
Diffstat (limited to 'tests/hazmat/primitives/test_rsa.py')
-rw-r--r-- | tests/hazmat/primitives/test_rsa.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index fc956ecb..09820429 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -24,6 +24,7 @@ from cryptography.hazmat.primitives.asymmetric import ( from cryptography.hazmat.primitives.asymmetric.rsa import ( RSAPrivateNumbers, RSAPublicNumbers ) +from cryptography.utils import CryptographyDeprecationWarning from .fixtures_rsa import ( RSA_KEY_1024, RSA_KEY_1025, RSA_KEY_1026, RSA_KEY_1027, RSA_KEY_1028, @@ -383,11 +384,8 @@ class TestRSASignature(object): n=private["modulus"] ) ).private_key(backend) - signer = pytest.deprecated_call( - private_key.signer, - padding.PKCS1v15(), - hashes.SHA1() - ) + with pytest.warns(CryptographyDeprecationWarning): + signer = private_key.signer(padding.PKCS1v15(), hashes.SHA1()) signer.update(binascii.unhexlify(example["message"])) signature = signer.finalize() assert binascii.hexlify(signature) == example["signature"] @@ -714,12 +712,12 @@ class TestRSAVerification(object): e=public["public_exponent"], n=public["modulus"] ).public_key(backend) - verifier = pytest.deprecated_call( - public_key.verifier, - binascii.unhexlify(example["signature"]), - padding.PKCS1v15(), - hashes.SHA1() - ) + with pytest.warns(CryptographyDeprecationWarning): + verifier = public_key.verifier( + binascii.unhexlify(example["signature"]), + padding.PKCS1v15(), + hashes.SHA1() + ) verifier.update(binascii.unhexlify(example["message"])) verifier.verify() |