File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -1085,6 +1085,25 @@ async def test_4_4_speculative_authentication_should_be_ignored_on_reauthenticat
1085
1085
# Assert there were `SaslStart` commands executed.
1086
1086
assert any (event .command_name .lower () == "saslstart" for event in listener .started_events )
1087
1087
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
+
1088
1107
async def test_5_1_azure_with_no_username (self ):
1089
1108
if ENVIRON != "azure" :
1090
1109
raise unittest .SkipTest ("Test is only supported on Azure" )
Original file line number Diff line number Diff line change @@ -1083,6 +1083,25 @@ def test_4_4_speculative_authentication_should_be_ignored_on_reauthentication(se
1083
1083
# Assert there were `SaslStart` commands executed.
1084
1084
assert any (event .command_name .lower () == "saslstart" for event in listener .started_events )
1085
1085
1086
+ def test_4_5_reauthentication_succeeds_when_a_session_is_involved (self ):
1087
+ # Create an OIDC configured client.
1088
+ client = self .create_client ()
1089
+
1090
+ # Set a fail point for `find` commands of the form:
1091
+ with self .fail_point (
1092
+ {
1093
+ "mode" : {"times" : 1 },
1094
+ "data" : {"failCommands" : ["find" ], "errorCode" : 391 },
1095
+ }
1096
+ ):
1097
+ # Start a new session.
1098
+ with client .start_session () as session :
1099
+ # In the started session perform a `find` operation that succeeds.
1100
+ client .test .test .find_one ({}, session = session )
1101
+
1102
+ # Assert that the callback was called 2 times (once during the connection handshake, and again during reauthentication).
1103
+ self .assertEqual (self .request_called , 2 )
1104
+
1086
1105
def test_5_1_azure_with_no_username (self ):
1087
1106
if ENVIRON != "azure" :
1088
1107
raise unittest .SkipTest ("Test is only supported on Azure" )
You can’t perform that action at this time.
0 commit comments