def test_ocsp_incomplete_chain():
    """
    Test incomplete chained certificate
    """
    incomplete_chain_cert = path.join(THIS_DIR, 'data', 'cert_tests',
                                      'incomplete-chain.pem')

    SnowflakeOCSP.clear_cache()  # reset the memory cache
    ocsp = SFOCSP()

    with pytest.raises(OperationalError) as ex:
        ocsp.validate_certfile(incomplete_chain_cert)
    assert 'CA certificate is NOT found' in ex.value.msg
def test_ocsp_revoked_certificate():
    """
    Test Revoked certificate.
    """
    revoked_cert = path.join(THIS_DIR, 'data', 'cert_tests',
                             'revoked_certs.pem')

    SnowflakeOCSP.clear_cache()  # reset the memory cache
    ocsp = SFOCSP()

    with pytest.raises(OperationalError) as ex:
        ocsp.validate_certfile(revoked_cert)
    assert ex.value.errno == ex.value.errno == ER_SERVER_CERTIFICATE_REVOKED