diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2018-12-12 10:35:27 +0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2018-12-11 21:35:27 -0500 |
commit | 89e1e34d977e565171329c26de6ce9c8f12340e7 (patch) | |
tree | e4a01197009f171443392a7e172e756667a86448 /tests/hazmat/primitives/test_ec.py | |
parent | 4c5740a6747b78502f432b662024e5bf6a4ae8c4 (diff) | |
download | cryptography-89e1e34d977e565171329c26de6ce9c8f12340e7.tar.gz cryptography-89e1e34d977e565171329c26de6ce9c8f12340e7.tar.bz2 cryptography-89e1e34d977e565171329c26de6ce9c8f12340e7.zip |
deprecate old from_encoded_point (#4640)
Diffstat (limited to 'tests/hazmat/primitives/test_ec.py')
-rw-r--r-- | tests/hazmat/primitives/test_ec.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py index 9a8ddf60..7cf9a09a 100644 --- a/tests/hazmat/primitives/test_ec.py +++ b/tests/hazmat/primitives/test_ec.py @@ -188,9 +188,10 @@ def test_from_encoded_point(): "04233ea3b0027127084cd2cd336a13aeef69c598d8af61369a36454a17c6c22ae" "c3ea2c10a84153862be4ec82940f0543f9ba866af9751a6ee79d38460b35f442e" ) - pn = ec.EllipticCurvePublicNumbers.from_encoded_point( - ec.SECP256R1(), data - ) + with pytest.warns(CryptographyDeprecationWarning): + pn = ec.EllipticCurvePublicNumbers.from_encoded_point( + ec.SECP256R1(), data + ) assert pn.x == int( '233ea3b0027127084cd2cd336a13aeef69c598d8af61369a36454a17c6c22aec', 16 @@ -207,9 +208,10 @@ def test_from_encoded_point_invalid_length(): "c3ea2c10a84153862be4ec82940f0543f9ba866af9751a6ee79d38460" ) with pytest.raises(ValueError): - ec.EllipticCurvePublicNumbers.from_encoded_point( - ec.SECP384R1(), bad_data - ) + with pytest.warns(CryptographyDeprecationWarning): + ec.EllipticCurvePublicNumbers.from_encoded_point( + ec.SECP384R1(), bad_data + ) def test_from_encoded_point_unsupported_point_no_backend(): @@ -218,16 +220,18 @@ def test_from_encoded_point_unsupported_point_no_backend(): "02233ea3b0027127084cd2cd336a13aeef69c598d8af61369a36454a17c6c22a" ) with pytest.raises(ValueError): - ec.EllipticCurvePublicNumbers.from_encoded_point( - ec.SECP256R1(), unsupported_type - ) + with pytest.warns(CryptographyDeprecationWarning): + ec.EllipticCurvePublicNumbers.from_encoded_point( + ec.SECP256R1(), unsupported_type + ) def test_from_encoded_point_not_a_curve(): with pytest.raises(TypeError): - ec.EllipticCurvePublicNumbers.from_encoded_point( - "notacurve", b"\x04data" - ) + with pytest.warns(CryptographyDeprecationWarning): + ec.EllipticCurvePublicNumbers.from_encoded_point( + "notacurve", b"\x04data" + ) def test_ec_public_numbers_repr(): |