Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --usb-path option to select device #122

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! Add --usb-path option to select device
fix usb path test case
  • Loading branch information
robinkrahl committed Sep 9, 2020
commit 304d2dc00198b4b60b08cacc946511a28cfdd973
12 changes: 9 additions & 3 deletions src/tests/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,16 @@ fn connect_wrong_serial_number(_model: nitrokey::Model) {

#[test_device]
fn connect_usb_path(_model: nitrokey::Model) -> anyhow::Result<()> {
let devices = nitrokey::list_devices()?;
for path in devices.iter().map(|d| &d.path) {
let res = Nitrocli::new().handle(&["status", &format!("--usb-path={}", path)]);
for device in nitrokey::list_devices()? {
let res = Nitrocli::new().handle(&["status", &format!("--usb-path={}", device.path)]);
assert!(res.is_ok());
robinkrahl marked this conversation as resolved.
Show resolved Hide resolved
let res = res?;
if let Some(model) = device.model {
assert!(res.contains(&format!("model: {}\n", model)));
}
if let Some(sn) = device.serial_number {
assert!(res.contains(&format!("serial number: {}\n", sn)));
}
}
Ok(())
}
Expand Down