CCCID/CHUID: add basic tests and do some cleanups
- Adds tests for CCCID/CHUID, allowing not found (is that ok?) - Move constants under their respective modules and remove `YKPIV_`
This commit is contained in:
+33
-1
@@ -6,7 +6,7 @@
|
||||
use lazy_static::lazy_static;
|
||||
use log::trace;
|
||||
use std::{env, sync::Mutex};
|
||||
use yubikey_piv::{key::Key, YubiKey};
|
||||
use yubikey_piv::{key::Key, Error, YubiKey};
|
||||
|
||||
lazy_static! {
|
||||
/// Provide thread-safe access to a YubiKey
|
||||
@@ -27,6 +27,38 @@ fn init_yubikey() -> Mutex<YubiKey> {
|
||||
Mutex::new(yubikey)
|
||||
}
|
||||
|
||||
//
|
||||
// CCCID support
|
||||
//
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_get_cccid() {
|
||||
let mut yubikey = YUBIKEY.lock().unwrap();
|
||||
|
||||
match yubikey.cccid() {
|
||||
Ok(cccid) => trace!("CCCID: {:?}", cccid),
|
||||
Err(Error::NotFound) => trace!("CCCID not found"),
|
||||
Err(err) => panic!("error getting CCCID: {:?}", err),
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CHUID support
|
||||
//
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_get_chuid() {
|
||||
let mut yubikey = YUBIKEY.lock().unwrap();
|
||||
|
||||
match yubikey.chuid() {
|
||||
Ok(chuid) => trace!("CHUID: {:?}", chuid),
|
||||
Err(Error::NotFound) => trace!("CHUID not found"),
|
||||
Err(err) => panic!("error getting CHUID: {:?}", err),
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Device config support
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user