@@ -1370,92 +1370,76 @@ def test_server_session_keep_alive(conn_cnx):
1370
1370
1371
1371
1372
1372
@pytest .mark .skipolddriver
1373
- def test_ocsp_mode_disable_ocsp_checks (conn_cnx , is_public_test , caplog ):
1373
+ def test_ocsp_mode_disable_ocsp_checks (conn_cnx , caplog ):
1374
1374
caplog .set_level (logging .DEBUG , "snowflake.connector.ocsp_snowflake" )
1375
1375
with conn_cnx (disable_ocsp_checks = True ) as conn , conn .cursor () as cur :
1376
1376
assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1377
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1378
- caplog .clear ()
1379
-
1380
- with conn_cnx () as conn , conn .cursor () as cur :
1381
- assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1382
- if is_public_test :
1383
- assert "snowflake.connector.ocsp_snowflake" in caplog .text
1384
- assert "This connection does not perform OCSP checks." not in caplog .text
1385
- else :
1386
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1377
+ assert "snowflake.connector.ocsp_snowflake:" not in caplog .text
1387
1378
1388
1379
1389
1380
@pytest .mark .skipolddriver
1390
- def test_ocsp_mode_insecure_mode (conn_cnx , is_public_test , caplog ):
1381
+ def test_ocsp_mode_insecure_mode (conn_cnx , caplog ):
1391
1382
caplog .set_level (logging .DEBUG , "snowflake.connector.ocsp_snowflake" )
1392
1383
with conn_cnx (insecure_mode = True ) as conn , conn .cursor () as cur :
1393
1384
assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1394
- if is_public_test :
1395
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1396
- assert "This connection does not perform OCSP checks." in caplog .text
1397
- else :
1398
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1385
+ # insecure_mode=True means OCSP is disabled
1386
+ assert "snowflake.connector.ocsp_snowflake:" not in caplog .text
1387
+ assert "This connection does not perform OCSP checks." in caplog .text
1399
1388
1400
1389
1401
1390
@pytest .mark .skipolddriver
1402
- def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_match (
1403
- conn_cnx , is_public_test , caplog
1404
- ):
1391
+ def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_match (conn_cnx , caplog ):
1405
1392
caplog .set_level (logging .DEBUG , "snowflake.connector.ocsp_snowflake" )
1406
1393
with conn_cnx (
1407
1394
insecure_mode = True , disable_ocsp_checks = True
1408
1395
) as conn , conn .cursor () as cur :
1409
1396
assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1410
- if is_public_test :
1411
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1412
- assert (
1413
- "The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
1414
- "Using the value of 'disable_ocsp_checks."
1415
- ) not in caplog .text
1416
- assert "This connection does not perform OCSP checks." in caplog .text
1417
- else :
1418
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1397
+ assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1398
+ assert (
1399
+ "The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
1400
+ "Using the value of 'disable_ocsp_checks."
1401
+ ) not in caplog .text
1402
+ assert "This connection does not perform OCSP checks." in caplog .text
1419
1403
1420
1404
1421
1405
@pytest .mark .skipolddriver
1422
1406
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_mismatch_ocsp_disabled (
1423
- conn_cnx , is_public_test , caplog
1407
+ conn_cnx , caplog
1424
1408
):
1425
1409
caplog .set_level (logging .DEBUG , "snowflake.connector.ocsp_snowflake" )
1426
1410
with conn_cnx (
1427
1411
insecure_mode = False , disable_ocsp_checks = True
1428
1412
) as conn , conn .cursor () as cur :
1429
1413
assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1430
- if is_public_test :
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
1436
- assert "This connection does not perform OCSP checks." in caplog .text
1437
- else :
1438
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1414
+ # disable_ocsp_checks=True takes precedence, so OCSP should be disabled
1415
+ assert "snowflake.connector.ocsp_snowflake:" not in caplog .text
1416
+ assert (
1417
+ "The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
1418
+ "Using the value of 'disable_ocsp_checks."
1419
+ ) in caplog .text
1439
1420
1440
1421
1441
1422
@pytest .mark .skipolddriver
1442
1423
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_mismatch_ocsp_enabled (
1443
- conn_cnx , is_public_test , caplog
1424
+ conn_cnx , caplog
1444
1425
):
1445
1426
caplog .set_level (logging .DEBUG , "snowflake.connector.ocsp_snowflake" )
1446
1427
with conn_cnx (
1447
1428
insecure_mode = True , disable_ocsp_checks = False
1448
1429
) as conn , conn .cursor () as cur :
1449
1430
assert cur .execute ("select 1" ).fetchall () == [(1 ,)]
1450
- if is_public_test :
1451
- assert "snowflake.connector.ocsp_snowflake" in caplog .text
1452
- assert (
1453
- "The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
1454
- "Using the value of 'disable_ocsp_checks."
1455
- ) in caplog .text
1431
+ # disable_ocsp_checks=False takes precedence, so OCSP should be enabled
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
1436
+ if "This connection is in OCSP Fail Open Mode" in caplog .text :
1437
+ # OCSP is enabled, should see OCSP activity
1438
+ assert "snowflake.connector.ocsp_snowflake:" in caplog .text
1456
1439
assert "This connection does not perform OCSP checks." not in caplog .text
1457
1440
else :
1458
- assert "snowflake.connector.ocsp_snowflake" not in caplog .text
1441
+ # OCSP is disabled, should not see OCSP activity
1442
+ assert "snowflake.connector.ocsp_snowflake:" not in caplog .text
1459
1443
1460
1444
1461
1445
@pytest .mark .skipolddriver
0 commit comments