From 3e3444fa96a3fa911e99e1c12f1a0d859563ce2c Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 11 Jul 2016 17:03:13 -0400 Subject: Use a series of constants for OpenSSL version checks (#3037) * Use a series of constants for OpenSSL version checks. N.B. I removed several qualifiers that were being used to express beta vs. release in OpenSSL version numbers. Reviewers please look closely! * Convert some python as well, also add the file * flake8 * Simplify code, remove functionality that can be expressed more simply * clean up the tests as well * more constants * wrap long lines * reflect feedback * unused * add this back? --- tests/test_x509.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/test_x509.py') diff --git a/tests/test_x509.py b/tests/test_x509.py index ebe6dc50..40efb6da 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -1935,7 +1935,7 @@ class TestCertificateBuilder(object): @pytest.mark.requires_backend_interface(interface=DSABackend) @pytest.mark.requires_backend_interface(interface=X509Backend) def test_build_cert_with_dsa_private_key(self, backend): - if backend._lib.OPENSSL_VERSION_NUMBER < 0x10001000: + if backend._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_101: pytest.skip("Requires a newer OpenSSL. Must be >= 1.0.1") issuer_private_key = DSA_KEY_2048.private_key(backend) @@ -1983,7 +1983,7 @@ class TestCertificateBuilder(object): @pytest.mark.requires_backend_interface(interface=EllipticCurveBackend) @pytest.mark.requires_backend_interface(interface=X509Backend) def test_build_cert_with_ec_private_key(self, backend): - if backend._lib.OPENSSL_VERSION_NUMBER < 0x10001000: + if backend._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_101: pytest.skip("Requires a newer OpenSSL. Must be >= 1.0.1") _skip_curve_unsupported(backend, ec.SECP256R1()) @@ -2537,7 +2537,7 @@ class TestCertificateSigningRequestBuilder(object): @pytest.mark.requires_backend_interface(interface=EllipticCurveBackend) def test_build_ca_request_with_ec(self, backend): - if backend._lib.OPENSSL_VERSION_NUMBER < 0x10001000: + if backend._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_101: pytest.skip("Requires a newer OpenSSL. Must be >= 1.0.1") _skip_curve_unsupported(backend, ec.SECP256R1()) @@ -2567,7 +2567,7 @@ class TestCertificateSigningRequestBuilder(object): @pytest.mark.requires_backend_interface(interface=DSABackend) def test_build_ca_request_with_dsa(self, backend): - if backend._lib.OPENSSL_VERSION_NUMBER < 0x10001000: + if backend._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_101: pytest.skip("Requires a newer OpenSSL. Must be >= 1.0.1") private_key = DSA_KEY_2048.private_key(backend) -- cgit v1.2.3