@@ -1386,92 +1386,76 @@ def test_server_session_keep_alive(conn_cnx):
1386
1386
1387
1387
1388
1388
@pytest .mark .skipolddriver
1389
- def test_ocsp_mode_disable_ocsp_checks (conn_cnx , is_public_test , caplog ):
1389
+ def test_ocsp_mode_disable_ocsp_checks (conn_cnx , caplog ):
1390
1390
caplog .set_level (logging .DEBUG , "snowflake.connector.ocsp_snowflake" )
1391
1391
with conn_cnx (disable_ocsp_checks = True ) as conn , conn .cursor () as cur :
1392
1392
assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1393
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1394
- caplog .clear ()
1395
-
1396
- with conn_cnx () as conn , conn .cursor () as cur :
1397
- assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1398
- if is_public_test :
1399
- assert "snowflake.connector.ocsp_snowflake" in caplog .text
1400
- assert "This connection does not perform OCSP checks." not in caplog .text
1401
- else :
1402
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1393
+ assert "snowflake.connector.ocsp_snowflake:" not in caplog .text
1403
1394
1404
1395
1405
1396
@pytest .mark .skipolddriver
1406
- def test_ocsp_mode_insecure_mode (conn_cnx , is_public_test , caplog ):
1397
+ def test_ocsp_mode_insecure_mode (conn_cnx , caplog ):
1407
1398
caplog .set_level (logging .DEBUG , "snowflake.connector.ocsp_snowflake" )
1408
1399
with conn_cnx (insecure_mode = True ) as conn , conn .cursor () as cur :
1409
1400
assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1410
- if is_public_test :
1411
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1412
- assert "This connection does not perform OCSP checks." in caplog .text
1413
- else :
1414
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1401
+ # insecure_mode=True means OCSP is disabled
1402
+ assert "snowflake.connector.ocsp_snowflake:" not in caplog .text
1403
+ assert "This connection does not perform OCSP checks." in caplog .text
1415
1404
1416
1405
1417
1406
@pytest .mark .skipolddriver
1418
- def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_match (
1419
- conn_cnx , is_public_test , caplog
1420
- ):
1407
+ def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_match (conn_cnx , caplog ):
1421
1408
caplog .set_level (logging .DEBUG , "snowflake.connector.ocsp_snowflake" )
1422
1409
with conn_cnx (
1423
1410
insecure_mode = True , disable_ocsp_checks = True
1424
1411
) as conn , conn .cursor () as cur :
1425
1412
assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1426
- if is_public_test :
1427
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1428
- assert (
1429
- "The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
1430
- "Using the value of 'disable_ocsp_checks."
1431
- ) not in caplog .text
1432
- assert "This connection does not perform OCSP checks." in caplog .text
1433
- else :
1434
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1413
+ assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1414
+ assert (
1415
+ "The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
1416
+ "Using the value of 'disable_ocsp_checks."
1417
+ ) not in caplog .text
1418
+ assert "This connection does not perform OCSP checks." in caplog .text
1435
1419
1436
1420
1437
1421
@pytest .mark .skipolddriver
1438
1422
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_mismatch_ocsp_disabled (
1439
- conn_cnx , is_public_test , caplog
1423
+ conn_cnx , caplog
1440
1424
):
1441
1425
caplog .set_level (logging .DEBUG , "snowflake.connector.ocsp_snowflake" )
1442
1426
with conn_cnx (
1443
1427
insecure_mode = False , disable_ocsp_checks = True
1444
1428
) as conn , conn .cursor () as cur :
1445
1429
assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1446
- if is_public_test :
1447
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1448
- assert (
1449
- "The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
1450
- "Using the value of 'disable_ocsp_checks."
1451
- ) in caplog .text
1452
- assert "This connection does not perform OCSP checks." in caplog .text
1453
- else :
1454
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1430
+ # disable_ocsp_checks=True takes precedence, so OCSP should be disabled
1431
+ assert "snowflake.connector.ocsp_snowflake:" not in caplog .text
1432
+ assert (
1433
+ "The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
1434
+ "Using the value of 'disable_ocsp_checks."
1435
+ ) in caplog .text
1455
1436
1456
1437
1457
1438
@pytest .mark .skipolddriver
1458
1439
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_mismatch_ocsp_enabled (
1459
- conn_cnx , is_public_test , caplog
1440
+ conn_cnx , caplog
1460
1441
):
1461
1442
caplog .set_level (logging .DEBUG , "snowflake.connector.ocsp_snowflake" )
1462
1443
with conn_cnx (
1463
1444
insecure_mode = True , disable_ocsp_checks = False
1464
1445
) as conn , conn .cursor () as cur :
1465
1446
assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1466
- if is_public_test :
1467
- assert "snowflake.connector.ocsp_snowflake" in caplog .text
1468
- assert (
1469
- "The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
1470
- "Using the value of 'disable_ocsp_checks."
1471
- ) in caplog .text
1447
+ # disable_ocsp_checks=False takes precedence, so OCSP should be enabled
1448
+ assert (
1449
+ "The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
1450
+ "Using the value of 'disable_ocsp_checks."
1451
+ ) in caplog .text
1452
+ if "This connection is in OCSP Fail Open Mode" in caplog .text :
1453
+ # OCSP is enabled, should see OCSP activity
1454
+ assert "snowflake.connector.ocsp_snowflake:" in caplog .text
1472
1455
assert "This connection does not perform OCSP checks." not in caplog .text
1473
1456
else :
1474
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1457
+ # OCSP is disabled, should not see OCSP activity
1458
+ assert "snowflake.connector.ocsp_snowflake:" not in caplog .text
1475
1459
1476
1460
1477
1461
@pytest .mark .skipolddriver
0 commit comments