You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: base-library/src/auth.rs
+70-18
Original file line number
Diff line number
Diff line change
@@ -299,6 +299,7 @@ mod tests {
299
299
log::LevelFilter,
300
300
ring::digest::SHA256_OUTPUT_LEN,
301
301
scratchstack_aws_principal::{Principal,User},
302
+
std::{error::Error, fs::File},
302
303
tower::BoxError,
303
304
};
304
305
@@ -364,6 +365,10 @@ mod tests {
364
365
"The security token included in the request is invalid".to_string(),
365
366
)))
366
367
}
368
+
"io-error" => {
369
+
let e = File::open("/00Hi1i6V4qad5nF/6KPlcyW4H9miTOD02meLgTaV09O2UToMPTE9j6sNmHZ/08EzM4qOs8bYOINWJ9RheQVadpgixRTh0VjcwpVPoo1Rh4gNAJhS4cj/this-path/does//not/exist").unwrap_err();
370
+
returnErr(Box::new(SignatureError::from(e)));
371
+
}
367
372
"expired" => {
368
373
returnErr(Box::new(SignatureError::ExpiredToken(
369
374
"The security token included in the request is expired".to_string(),
@@ -427,11 +432,13 @@ mod tests {
427
432
.await
428
433
.unwrap_err();
429
434
430
-
ifletSignatureError::SignatureDoesNotMatch(msg) = e {
435
+
ifletSignatureError::SignatureDoesNotMatch(refmsg) = e {
431
436
assert_eq!(
432
-
msg.unwrap().as_str(),
437
+
msg.as_ref().unwrap(),
433
438
"Signature expired: 20150830T122059Z is now earlier than 20150830T122100Z (20150830T123600Z - 15 min.)"
ifletSignatureError::IncompleteSignature(msg) = e {
485
+
ifletSignatureError::IncompleteSignature(_) = e {
477
486
assert_eq!(
478
-
msg.as_str(),
487
+
e.to_string(),
479
488
"Credential must have exactly 5 slash-delimited elements, e.g. keyid/date/region/service/term, got 'AKIDFOO/20130101/wrong-region/wrong-service'"
480
489
);
490
+
assert_eq!(e.error_code(),"IncompleteSignature");
491
+
assert_eq!(e.http_status(),400);
481
492
}else{
482
493
panic!("Unexpected error: {:?}", e);
483
494
}
@@ -496,11 +507,13 @@ mod tests {
496
507
.await
497
508
.unwrap_err();
498
509
499
-
ifletSignatureError::SignatureDoesNotMatch(msg) = e {
510
+
ifletSignatureError::SignatureDoesNotMatch(_) = e {
500
511
assert_eq!(
501
-
msg.unwrap().as_str(),
512
+
e.to_string(),
502
513
"Credential should be scoped to a valid region, not 'wrong-region'. Credential should be scoped to correct service: 'example'. Credential should be scoped with a valid terminator: 'aws4_request', not 'aws5_request'. Date in Credential scope does not match YYYYMMDD from ISO-8601 version of date from HTTP: '20130101' != '20150830', from '20150830T123600Z'."
ifletSignatureError::SignatureDoesNotMatch(msg) = e {
603
-
assert_eq!(msg.unwrap().as_str(),"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.");
653
+
ifletSignatureError::SignatureDoesNotMatch(_) = e {
654
+
assert_eq!(e.to_string(),"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.");
0 commit comments