Change all chrono::UTC to chrono::Utc

This commit is contained in:
PoiScript 2017-08-22 23:14:10 +08:00
parent 18106c2e0c
commit 277898f08f
2 changed files with 14 additions and 14 deletions

View File

@ -64,7 +64,7 @@ impl<L: Lifetime> FromResponse for Bearer<L> {
#[cfg(test)]
mod tests {
use chrono::{UTC, Duration};
use chrono::{Utc, Duration};
use client::response::{FromResponse, ParseError};
use token::{Static, Refresh};
@ -135,8 +135,8 @@ mod tests {
assert_eq!(None, bearer.scope);
let refresh = bearer.lifetime;
assert_eq!("bbbbbbbb", refresh.refresh_token());
assert!(refresh.expires() > &UTC::now());
assert!(refresh.expires() <= &(UTC::now() + Duration::seconds(3600)));
assert!(refresh.expires() > &Utc::now());
assert!(refresh.expires() <= &(Utc::now() + Duration::seconds(3600)));
}
#[test]
@ -163,7 +163,7 @@ mod tests {
assert_eq!(None, bearer.scope);
let refresh = bearer.lifetime;
assert_eq!("bbbbbbbb", refresh.refresh_token());
assert!(refresh.expires() > &UTC::now());
assert!(refresh.expires() <= &(UTC::now() + Duration::seconds(3600)));
assert!(refresh.expires() > &Utc::now());
assert!(refresh.expires() <= &(Utc::now() + Duration::seconds(3600)));
}
}

View File

@ -4,7 +4,7 @@ extern crate inth_oauth2;
#[macro_use]
extern crate yup_hyper_mock;
use chrono::{UTC, Duration};
use chrono::{Utc, Duration};
use inth_oauth2::{Client, ClientError, Token, Lifetime};
use inth_oauth2::error::OAuth2ErrorCode;
@ -95,8 +95,8 @@ fn request_token_bearer_expiring_success() {
assert_eq!("aaaaaaaa", token.access_token());
assert_eq!(Some("example"), token.scope());
assert_eq!(false, token.lifetime().expired());
assert!(token.lifetime().expires() > &UTC::now());
assert!(token.lifetime().expires() <= &(UTC::now() + Duration::seconds(3600)));
assert!(token.lifetime().expires() > &Utc::now());
assert!(token.lifetime().expires() <= &(Utc::now() + Duration::seconds(3600)));
}
#[test]
@ -107,8 +107,8 @@ fn request_token_bearer_refresh_success() {
assert_eq!(Some("example"), token.scope());
assert_eq!("bbbbbbbb", token.lifetime().refresh_token());
assert_eq!(false, token.lifetime().expired());
assert!(token.lifetime().expires() > &UTC::now());
assert!(token.lifetime().expires() <= &(UTC::now() + Duration::seconds(3600)));
assert!(token.lifetime().expires() > &Utc::now());
assert!(token.lifetime().expires() <= &(Utc::now() + Duration::seconds(3600)));
}
#[test]
@ -120,8 +120,8 @@ fn refresh_token_bearer_full() {
assert_eq!(Some("example"), token.scope());
assert_eq!("dddddddd", token.lifetime().refresh_token());
assert_eq!(false, token.lifetime().expired());
assert!(token.lifetime().expires() > &UTC::now());
assert!(token.lifetime().expires() <= &(UTC::now() + Duration::seconds(3600)));
assert!(token.lifetime().expires() > &Utc::now());
assert!(token.lifetime().expires() <= &(Utc::now() + Duration::seconds(3600)));
}
#[test]
@ -133,8 +133,8 @@ fn refresh_token_bearer_partial() {
assert_eq!(Some("example"), token.scope());
assert_eq!("bbbbbbbb", token.lifetime().refresh_token());
assert_eq!(false, token.lifetime().expired());
assert!(token.lifetime().expires() > &UTC::now());
assert!(token.lifetime().expires() <= &(UTC::now() + Duration::seconds(3600)));
assert!(token.lifetime().expires() > &Utc::now());
assert!(token.lifetime().expires() <= &(Utc::now() + Duration::seconds(3600)));
}
#[test]