Skip to content

Commit

Permalink
Remove all local timezone in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timweri committed May 7, 2024
1 parent eee2dac commit ab90d81
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions tests/allowed-signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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]
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion tests/allowed-signers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
}
2 changes: 1 addition & 1 deletion tests/allowed_signers/good_allowed_signers
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ab90d81

Please sign in to comment.