#![allow(missing_docs)]
use chrono::{DateTime, Utc};
use force::auth::{AccessToken, TokenResponse};
#[test]
fn havoc_access_token_overflow() {
let max_time = DateTime::<Utc>::MAX_UTC;
let max_timestamp_ms = max_time.timestamp_millis();
let response = TokenResponse {
access_token: "token".to_string(),
instance_url: "url".to_string(),
token_type: "Bearer".to_string(),
issued_at: max_timestamp_ms.to_string(),
signature: "sig".to_string(),
expires_in: Some(1), refresh_token: None,
};
let token = AccessToken::from_response(response);
assert!(
token.expires_at().is_none(),
"Expiration should be None on overflow"
);
assert!(
!token.is_expired(),
"Token with None expiration should not be expired"
);
}