Handle metadata command not being supported in test (#516)

Some YubiKeys don't support this command. Instead of failing the test
when it happens, log a warning message instead.
This commit is contained in:
Tony Arcieri (iqlusion)
2023-08-15 17:21:45 -07:00
committed by GitHub
parent 78313360a1
commit 75ce24a3ea
+8 -3
View File
@@ -303,9 +303,14 @@ fn test_read_metadata() {
) )
.unwrap(); .unwrap();
let metadata = piv::metadata(&mut yubikey, slot).unwrap(); match piv::metadata(&mut yubikey, slot) {
Ok(metadata) => assert_eq!(metadata.public, Some(generated)),
assert_eq!(metadata.public, Some(generated)); Err(Error::NotSupported) => {
// Some YubiKeys don't support metadata
eprintln!("metadata not supported by this YubiKey");
}
Err(err) => panic!("{}", err),
}
} }
#[test] #[test]