Skip to content

Commit 316ea1a

Browse files
authored
RUST-1990: Update human_4_4 to correctly show that the callback count will be 3 on a failed refresh by returning bad tokens on subsequent calls (#1166)
1 parent 5a17794 commit 316ea1a

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/test/spec/oidc.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,12 +1074,22 @@ mod basic {
10741074
.oidc_callback(oidc::Callback::human(move |_| {
10751075
let call_count = cb_call_count.clone();
10761076
async move {
1077-
*call_count.lock().await += 1;
1078-
Ok(oidc::IdpServerResponse {
1079-
access_token: tokio::fs::read_to_string(token_dir!("test_user1")).await?,
1080-
expires: None,
1081-
refresh_token: None,
1082-
})
1077+
let mut cc = call_count.lock().await;
1078+
*cc += 1;
1079+
if *cc == 1 {
1080+
Ok(oidc::IdpServerResponse {
1081+
access_token: tokio::fs::read_to_string(token_dir!("test_user1"))
1082+
.await?,
1083+
expires: None,
1084+
refresh_token: Some("fake refresh token".to_string()),
1085+
})
1086+
} else {
1087+
Ok(oidc::IdpServerResponse {
1088+
access_token: "bad token".to_string(),
1089+
expires: None,
1090+
refresh_token: Some("fake refresh token".to_string()),
1091+
})
1092+
}
10831093
}
10841094
.boxed()
10851095
}))
@@ -1112,7 +1122,7 @@ mod basic {
11121122
crate::error::ErrorKind::Authentication { .. },
11131123
));
11141124

1115-
assert_eq!(2, *(*call_count).lock().await);
1125+
assert_eq!(3, *(*call_count).lock().await);
11161126
Ok(())
11171127
}
11181128

0 commit comments

Comments
 (0)