From 369a9c61a8247211cf1e59d324f26f7d8846e483 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 1 Aug 2015 12:35:25 +0100 Subject: add test for conditional removal --- tests/hazmat/bindings/test_openssl.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py index f3f2eaf4..c5f0a7d7 100644 --- a/tests/hazmat/bindings/test_openssl.py +++ b/tests/hazmat/bindings/test_openssl.py @@ -161,3 +161,21 @@ class TestOpenSSL(object): expected_options = current_options | b.lib.SSL_OP_ALL assert resp == expected_options assert b.lib.SSL_get_mode(ssl) == expected_options + + def test_conditional_removal(self): + b = Binding() + if b.lib.OPENSSL_VERSION_NUMBER >= 0x10000000: + assert b.lib.X509_V_ERR_DIFFERENT_CRL_SCOPE + assert b.lib.X509_V_ERR_CRL_PATH_VALIDATION_ERROR + else: + with pytest.raises(AttributeError): + b.lib.X509_V_ERR_DIFFERENT_CRL_SCOPE + + with pytest.raises(AttributeError): + b.lib.X509_V_ERR_CRL_PATH_VALIDATION_ERROR + + if b.lib.OPENSSL_VERSION_NUMBER >= 0x10001000: + assert b.lib.CMAC_Init + else: + with pytest.raises(AttributeError): + b.lib.CMAC_Init -- cgit v1.2.3