Skip to content

Commit 6693834

Browse files
fix sync tests
1 parent a51bec4 commit 6693834

File tree

1 file changed

+31
-47
lines changed

1 file changed

+31
-47
lines changed

test/integ/test_connection.py

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,92 +1386,76 @@ def test_server_session_keep_alive(conn_cnx):
13861386

13871387

13881388
@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):
13901390
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
13911391
with conn_cnx(disable_ocsp_checks=True) as conn, conn.cursor() as cur:
13921392
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
14031394

14041395

14051396
@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):
14071398
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14081399
with conn_cnx(insecure_mode=True) as conn, conn.cursor() as cur:
14091400
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
14151404

14161405

14171406
@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):
14211408
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14221409
with conn_cnx(
14231410
insecure_mode=True, disable_ocsp_checks=True
14241411
) as conn, conn.cursor() as cur:
14251412
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
14351419

14361420

14371421
@pytest.mark.skipolddriver
14381422
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_mismatch_ocsp_disabled(
1439-
conn_cnx, is_public_test, caplog
1423+
conn_cnx, caplog
14401424
):
14411425
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14421426
with conn_cnx(
14431427
insecure_mode=False, disable_ocsp_checks=True
14441428
) as conn, conn.cursor() as cur:
14451429
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
14551436

14561437

14571438
@pytest.mark.skipolddriver
14581439
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_mismatch_ocsp_enabled(
1459-
conn_cnx, is_public_test, caplog
1440+
conn_cnx, caplog
14601441
):
14611442
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14621443
with conn_cnx(
14631444
insecure_mode=True, disable_ocsp_checks=False
14641445
) as conn, conn.cursor() as cur:
14651446
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
14721455
assert "This connection does not perform OCSP checks." not in caplog.text
14731456
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
14751459

14761460

14771461
@pytest.mark.skipolddriver

0 commit comments

Comments
 (0)