Test Config::get

Tests reading configuration from a live device:

    Config { protected_data_available: false, puk_blocked: false, puk_noblock_on_upgrade: false, pin_last_changed: 0, mgm_type: Manual }
This commit is contained in:
Tony Arcieri
2019-12-07 11:40:25 -08:00
parent 509c438330
commit cdecfd92dd
7 changed files with 69 additions and 19 deletions
+24 -3
View File
@@ -27,14 +27,23 @@ fn init_yubikey() -> Mutex<YubiKey> {
Mutex::new(yubikey)
}
//
// Device config support
//
#[test]
#[ignore]
fn test_verify_pin() {
fn test_get_config() {
let mut yubikey = YUBIKEY.lock().unwrap();
assert!(yubikey.verify_pin(b"000000").is_err());
assert!(yubikey.verify_pin(b"123456").is_ok());
let config_result = yubikey.config();
assert!(config_result.is_ok());
trace!("config: {:?}", config_result.unwrap());
}
//
// Cryptographic key support
//
#[test]
#[ignore]
fn test_list_keys() {
@@ -43,3 +52,15 @@ fn test_list_keys() {
assert!(keys_result.is_ok());
trace!("keys: {:?}", keys_result.unwrap());
}
//
// PIN support
//
#[test]
#[ignore]
fn test_verify_pin() {
let mut yubikey = YUBIKEY.lock().unwrap();
assert!(yubikey.verify_pin(b"000000").is_err());
assert!(yubikey.verify_pin(b"123456").is_ok());
}