mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-01-06 11:19:39 +01:00
Extend the refresh tests.
Verify that a second refresh can happen after the first. This adds coverage to ensure that a refresh flow keeps the refresh token intact by showing that a second refresh can succeed.
This commit is contained in:
@@ -417,6 +417,28 @@ async fn test_refresh() {
|
||||
assert_eq!("accesstoken2", tok.as_str());
|
||||
_m.assert();
|
||||
|
||||
let _m = mockito::mock("POST", "/token")
|
||||
.match_body(mockito::Matcher::Regex(
|
||||
".*client_id=9022167.*refresh_token=refreshtoken.*".to_string(),
|
||||
))
|
||||
.with_body(
|
||||
serde_json::json!({
|
||||
"access_token": "accesstoken3",
|
||||
"token_type": "Bearer",
|
||||
"expires_in": 59,
|
||||
})
|
||||
.to_string(),
|
||||
)
|
||||
.expect(1)
|
||||
.create();
|
||||
|
||||
let tok = auth
|
||||
.token(&["https://googleapis.com/some/scope"])
|
||||
.await
|
||||
.expect("failed to get token");
|
||||
assert_eq!("accesstoken3", tok.as_str());
|
||||
_m.assert();
|
||||
|
||||
let _m = mockito::mock("POST", "/token")
|
||||
.match_body(mockito::Matcher::Regex(
|
||||
".*client_id=9022167.*refresh_token=refreshtoken.*".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user