Skip to content

Commit

Permalink
fix: failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
itsyaasir committed Aug 20, 2023
1 parent 365674a commit f4d7089
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions src/pesapal/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ pub async fn auth(client: &PesaPal) -> Result<AccessToken, PesaPalError> {
#[cfg(test)]
mod tests {

use cached::Cached;
use dotenvy::dotenv;

use super::*;
use crate::Environment;

#[test]
fn test_deserialize_utc_from_string() {
Expand All @@ -107,22 +103,4 @@ mod tests {
let response: AuthenticationResponse = serde_json::from_str(&json_str).unwrap();
assert_eq!(response.expiry_date, expected_datetime);
}

#[tokio::test]
async fn test_cached_access_token() {
dotenv().ok();

let client = PesaPal::new(
dotenvy::var("CONSUMER_KEY").unwrap(),
dotenvy::var("CONSUMER_SECRET").unwrap(),
Environment::Sandbox,
);
auth_prime_cache(&client).await.unwrap();

let mut cache = AUTH_CACHE.lock().await;

assert!(cache.cache_get(&client.consumer_key).is_some());
assert_eq!(cache.cache_hits().unwrap(), 1);
assert_eq!(cache.cache_capacity().unwrap(), 1);
}
}

0 comments on commit f4d7089

Please sign in to comment.