From c8edff82b60e9f7668f57aecc896be721fd3b475 Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 6 Aug 2025 18:35:34 -0400 Subject: [PATCH] Test refactor --- src/token.rs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/token.rs b/src/token.rs index 7030475..ffc5004 100644 --- a/src/token.rs +++ b/src/token.rs @@ -131,6 +131,19 @@ pub fn create_token( mod tests { use super::*; + fn test_key() -> String { + String::from("c3092urmc2219ix320i40m293ic29IM09IN0u879Y8B98YB8yb86TN7B55R4yv4RCVU6Bi8YO8U") + } + + fn test_resource() -> TokenResource { + TokenResource { + issuer: String::from("icarus_auth_test"), + message: String::from("Authorization"), + audiences: vec![String::from("icarus_test")], + id: uuid::Uuid::nil(), + } + } + #[test] fn test_token_scope_check() { let mut token = Token::default(); @@ -148,15 +161,8 @@ mod tests { #[test] fn test_token_creation() { - let key = String::from( - "c3092urmc2219ix320i40m293ic29IM09IN0u879Y8B98YB8yb86TN7B55R4yv4RCVU6Bi8YO8U", - ); - let test_token_resource = TokenResource { - issuer: String::from("icarus_auth_test"), - message: String::from("Authorization"), - audiences: vec![String::from("icarus_test")], - id: uuid::Uuid::nil(), - }; + let key = test_key(); + let test_token_resource = test_resource(); let token_expiration_duration = time::Duration::hours(2); match create_token(&key, &test_token_resource, token_expiration_duration) {