From 277898f08ff0935a50588254cc6ed4713a61cfdc Mon Sep 17 00:00:00 2001 From: PoiScript Date: Tue, 22 Aug 2017 23:14:10 +0800 Subject: [PATCH] Change all chrono::UTC to chrono::Utc --- src/token/bearer.rs | 10 +++++----- tests/mock.rs | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/token/bearer.rs b/src/token/bearer.rs index efbb8b1..ded32aa 100644 --- a/src/token/bearer.rs +++ b/src/token/bearer.rs @@ -64,7 +64,7 @@ impl FromResponse for Bearer { #[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))); } } diff --git a/tests/mock.rs b/tests/mock.rs index f0e760b..1e58f68 100644 --- a/tests/mock.rs +++ b/tests/mock.rs @@ -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]