From 3d951ab54daea9c362bdae2e0945701955c412e5 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 30 Dec 2018 00:04:23 +0100 Subject: Add function Device::get_model This patch adds the function Device::get_model that returns the model of the connected Nitrokey stick. --- tests/device.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') diff --git a/tests/device.rs b/tests/device.rs index 2c8cfa6..a6098b7 100644 --- a/tests/device.rs +++ b/tests/device.rs @@ -81,6 +81,23 @@ fn disconnect() { assert_empty_serial_number(); } +fn require_model(model: nitrokey::Model) { + assert_eq!(model, nitrokey::connect().unwrap().get_model()); + assert_eq!(model, Target::connect().unwrap().get_model()); +} + +#[test] +#[cfg_attr(not(feature = "test-pro"), ignore)] +fn get_model_pro() { + require_model(nitrokey::Model::Pro); +} + +#[test] +#[cfg_attr(not(feature = "test-storage"), ignore)] +fn get_model_storage() { + require_model(nitrokey::Model::Storage); +} + #[test] #[cfg_attr(not(any(feature = "test-pro", feature = "test-storage")), ignore)] fn get_serial_number() { -- cgit v1.2.1