Skip to content

Commit 0daa9f9

Browse files
committed
update test
1 parent 6858516 commit 0daa9f9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/asynchronous/test_auth_oidc.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,25 @@ async def test_4_4_speculative_authentication_should_be_ignored_on_reauthenticat
10851085
# Assert there were `SaslStart` commands executed.
10861086
assert any(event.command_name.lower() == "saslstart" for event in listener.started_events)
10871087

1088+
async def test_4_5_reauthentication_succeeds_when_a_session_is_involved(self):
1089+
# Create an OIDC configured client.
1090+
client = await self.create_client()
1091+
1092+
# Set a fail point for `find` commands of the form:
1093+
async with self.fail_point(
1094+
{
1095+
"mode": {"times": 1},
1096+
"data": {"failCommands": ["find"], "errorCode": 391},
1097+
}
1098+
):
1099+
# Start a new session.
1100+
async with client.start_session() as session:
1101+
# In the started session perform a `find` operation that succeeds.
1102+
await client.test.test.find_one({}, session=session)
1103+
1104+
# Assert that the callback was called 2 times (once during the connection handshake, and again during reauthentication).
1105+
self.assertEqual(self.request_called, 2)
1106+
10881107
async def test_5_1_azure_with_no_username(self):
10891108
if ENVIRON != "azure":
10901109
raise unittest.SkipTest("Test is only supported on Azure")

0 commit comments

Comments
 (0)