From 1c186772f6fd64180bd3387de2e1ef1a6d1ba58e Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 18 Oct 2019 08:47:15 -0400 Subject: Fixes #5018 -- break users on OpenSSL 1.0.1 (#5022) * Fixes #5018 -- break users on OpenSSL 1.0.1 * Grammar * Syntax error * Missing import * Missing import --- tests/hazmat/bindings/test_openssl.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py index 29a1c459..e9bcc18e 100644 --- a/tests/hazmat/bindings/test_openssl.py +++ b/tests/hazmat/bindings/test_openssl.py @@ -4,11 +4,14 @@ from __future__ import absolute_import, division, print_function +import pretend + import pytest from cryptography.exceptions import InternalError from cryptography.hazmat.bindings.openssl.binding import ( - Binding, _consume_errors, _openssl_assert, _verify_package_version + Binding, _consume_errors, _openssl_assert, _verify_openssl_version, + _verify_package_version ) @@ -122,3 +125,12 @@ class TestOpenSSL(object): def test_version_mismatch(self): with pytest.raises(ImportError): _verify_package_version("nottherightversion") + + def test_verify_openssl_version(self, monkeypatch): + monkeypatch.delenv("CRYPTOGRAPHY_ALLOW_OPENSSL_101", raising=False) + lib = pretend.stub( + CRYPTOGRAPHY_OPENSSL_LESS_THAN_102=True, + CRYPTOGRAPHY_IS_LIBRESSL=False + ) + with pytest.raises(RuntimeError): + _verify_openssl_version(lib) -- cgit v1.2.3