From ab90d814aaf76d73e486271db32d870802154169 Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Tue, 7 May 2024 16:35:29 -0400 Subject: [PATCH] Remove all local timezone in tests --- tests/allowed-signer.rs | 16 ++++++++-------- tests/allowed-signers.rs | 2 +- tests/allowed_signers/good_allowed_signers | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/allowed-signer.rs b/tests/allowed-signer.rs index 737221e..6a23ce2 100644 --- a/tests/allowed-signer.rs +++ b/tests/allowed-signer.rs @@ -46,7 +46,7 @@ fn parse_good_allowed_signer_with_quoted_principals() { #[test] fn parse_good_allowed_signer_with_options() { let allowed_signer = - "mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces=\"thanh,mitchell\" valid-before=\"20240505\" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5"; + "mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces=\"thanh,mitchell\" valid-before=\"20240505Z\" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5"; let allowed_signer = AllowedSigner::from_string(allowed_signer); assert!(allowed_signer.is_ok()); let allowed_signer = allowed_signer.unwrap(); @@ -61,7 +61,7 @@ fn parse_good_allowed_signer_with_options() { Some(vec!["thanh".to_string(), "mitchell".to_string()]) ); assert!(allowed_signer.valid_after.is_none()); - assert_eq!(allowed_signer.valid_before, Some(1714881600i64)); + assert_eq!(allowed_signer.valid_before, Some(1714867200i64)); } #[test] @@ -88,7 +88,7 @@ fn parse_good_allowed_signer_with_utc_timestamp() { #[test] fn parse_good_allowed_signer_with_hm_timestamp() { let allowed_signer = - "mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces=\"thanh,mitchell\" valid-after=202405050102 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5"; + "mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces=\"thanh,mitchell\" valid-after=202405050102Z ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5"; let allowed_signer = AllowedSigner::from_string(allowed_signer); assert!(allowed_signer.is_ok()); let allowed_signer = allowed_signer.unwrap(); @@ -102,14 +102,14 @@ fn parse_good_allowed_signer_with_hm_timestamp() { allowed_signer.namespaces, Some(vec!["thanh".to_string(), "mitchell".to_string()]) ); - assert_eq!(allowed_signer.valid_after, Some(1714885320i64)); + assert_eq!(allowed_signer.valid_after, Some(1714870920i64)); assert!(allowed_signer.valid_before.is_none()); } #[test] fn parse_good_allowed_signer_with_hms_timestamp() { let allowed_signer = - "mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces=\"thanh,mitchell\" valid-after=20240505010230 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5"; + "mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces=\"thanh,mitchell\" valid-after=20240505010230Z ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5"; let allowed_signer = AllowedSigner::from_string(allowed_signer); assert!(allowed_signer.is_ok()); let allowed_signer = allowed_signer.unwrap(); @@ -123,14 +123,14 @@ fn parse_good_allowed_signer_with_hms_timestamp() { allowed_signer.namespaces, Some(vec!["thanh".to_string(), "mitchell".to_string()]) ); - assert_eq!(allowed_signer.valid_after, Some(1714885350i64)); + assert_eq!(allowed_signer.valid_after, Some(1714870950i64)); assert!(allowed_signer.valid_before.is_none()); } #[test] fn parse_good_allowed_signer_with_consecutive_spaces() { let allowed_signer = - "mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces=\"thanh,#mitchell\" valid-before=\"20240505\" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5 "; + "mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces=\"thanh,#mitchell\" valid-before=\"20240505Z\" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5 "; let allowed_signer = AllowedSigner::from_string(allowed_signer); assert!(allowed_signer.is_ok()); let allowed_signer = allowed_signer.unwrap(); @@ -145,7 +145,7 @@ fn parse_good_allowed_signer_with_consecutive_spaces() { Some(vec!["thanh".to_string(), "#mitchell".to_string()]) ); assert!(allowed_signer.valid_after.is_none()); - assert_eq!(allowed_signer.valid_before, Some(1714881600i64)); + assert_eq!(allowed_signer.valid_before, Some(1714867200i64)); } #[test] diff --git a/tests/allowed-signers.rs b/tests/allowed-signers.rs index 8e837ca..361825e 100644 --- a/tests/allowed-signers.rs +++ b/tests/allowed-signers.rs @@ -47,6 +47,6 @@ fn parse_good_allowed_signers() { assert!(allowed_signers[2].valid_after.is_none()); assert_eq!( allowed_signers[2].valid_before, - Some(1714881600i64), + Some(1714867200i64), ); } diff --git a/tests/allowed_signers/good_allowed_signers b/tests/allowed_signers/good_allowed_signers index 85a0087..14e9848 100644 --- a/tests/allowed_signers/good_allowed_signers +++ b/tests/allowed_signers/good_allowed_signers @@ -3,4 +3,4 @@ mitchell@confurious.io ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf # Empty lines are also ignored mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces="thanh,#mitchell" valid-before="20240505Z" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5 # End of line comment is ignored -mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces="thanh, ,mitchell mitchell, andrew andrew" valid-before="20240505" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5 +mitchell@confurious.io,mitchel2@confurious.io cert-authority namespaces="thanh, ,mitchell mitchell, andrew andrew" valid-before="20240505Z" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO0VQD9TIdICZLWFWwtf7s8/aENve8twGTEmNV0myh5