tests: Initial connect test and docs

Adds an extremely basic initial test to ensure that we are able to
connect to a YubiKey.

The test is marked `#[ignore]` in the hope that we can eventually start
adding tests which run in CI, e.g. against a mock card.

This also includes a fix for calculating the APDU size, since the ones
we were sending originally were overly long.
This commit is contained in:
Tony Arcieri
2019-11-25 09:45:02 -08:00
parent 4039560d97
commit fd77e9f844
10 changed files with 162 additions and 1309 deletions
+20
View File
@@ -0,0 +1,20 @@
//! Integration tests
#![forbid(unsafe_code)]
#![warn(missing_docs, rust_2018_idioms, trivial_casts, unused_qualifications)]
use std::env;
use yubikey_piv::YubiKey;
#[test]
#[ignore]
fn connect() {
// Only show logs if `RUST_LOG` is set
if env::var("RUST_LOG").is_ok() {
env_logger::builder().format_timestamp(None).init();
}
let mut yubikey = YubiKey::open(None).unwrap();
dbg!(&yubikey.version());
dbg!(&yubikey.serial());
}