From 89e1e34d977e565171329c26de6ce9c8f12340e7 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 12 Dec 2018 10:35:27 +0800 Subject: deprecate old from_encoded_point (#4640) --- tests/hazmat/primitives/test_ec.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'tests/hazmat/primitives') 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(): -- cgit v1.2.3