Skip to content

Commit fdd572d

Browse files
committed
DRIVERS-3915 Add a prose test for OIDC reauthentication when a session is involved
1 parent 2759379 commit fdd572d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/auth_oidc/test_auth_oidc.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,25 @@ def test_4_4_speculative_authentication_should_be_ignored_on_reauthentication(se
10751075
# Assert there were `SaslStart` commands executed.
10761076
assert any(event.command_name.lower() == "saslstart" for event in listener.started_events)
10771077

1078+
def test_4_5_reauthentication_succeeds_when_a_session_is_involved(self):
1079+
# Create an OIDC configured client.
1080+
client = self.create_client()
1081+
1082+
# Set a fail point for `find` commands of the form:
1083+
with self.fail_point(
1084+
{
1085+
"mode": {"times": 1},
1086+
"data": {"failCommands": ["find"], "errorCode": 391},
1087+
}
1088+
):
1089+
# Start a new session.
1090+
with client.start_session() as session:
1091+
# In the started session perform a `find` operation that succeeds.
1092+
client.test.test.find({}, session=session)
1093+
1094+
# Assert that the callback was called 2 times (once during the connection handshake, and again during reauthentication).
1095+
self.assertEqual(self.request_called, 2)
1096+
10781097
def test_5_1_azure_with_no_username(self):
10791098
if ENVIRON != "azure":
10801099
raise unittest.SkipTest("Test is only supported on Azure")

0 commit comments

Comments
 (0)