aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-01-25 20:33:57 +0100
committerDaniel Mueller <deso@posteo.net>2020-09-07 10:14:21 -0700
commit6917be7ab3c5a9d47866a45855c836a9cc6f86ff (patch)
treeca75486d09c9656e1bbf8ac7c68b5807483cef01 /src/tests
parent4d25d79f18cd2c5627c46727b425c745c78cf942 (diff)
downloadnitrocli-6917be7ab3c5a9d47866a45855c836a9cc6f86ff.tar.gz
nitrocli-6917be7ab3c5a9d47866a45855c836a9cc6f86ff.tar.bz2
Add --serial-number option
This patch adds the --serial-number option that allows the user to filter the attached Nitrokey devices by serial number. As the Nitrokey Storage does not include its serial number in the USB device descriptor and as we don't want to connect to it just to query the serial number, this option only works for Nitrokey Storage devices.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/status.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tests/status.rs b/src/tests/status.rs
index 7946929..268e36f 100644
--- a/src/tests/status.rs
+++ b/src/tests/status.rs
@@ -28,6 +28,16 @@ fn not_found_pro() {
assert_eq!(err, "Nitrokey device not found (filter: model=pro)");
}
+#[test_device]
+fn not_found_by_serial_number() {
+ let res = Nitrocli::new().handle(&["status", "--model=storage", "--serial-number=deadbeef"]);
+ let err = res.unwrap_err().to_string();
+ assert_eq!(
+ err,
+ "Nitrokey device not found (filter: model=storage, serial number in [0xdeadbeef])"
+ );
+}
+
#[test_device(pro)]
fn output_pro(model: nitrokey::Model) -> anyhow::Result<()> {
let re = regex::Regex::new(