summaryrefslogtreecommitdiff
path: root/tests/pws.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pws.rs')
-rw-r--r--tests/pws.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/pws.rs b/tests/pws.rs
index 32dc8f7..7805803 100644
--- a/tests/pws.rs
+++ b/tests/pws.rs
@@ -33,7 +33,7 @@ fn get_slot_name_direct(slot: u8) -> Result<String, Error> {
}
}
-fn get_pws<T>(device: &T) -> PasswordSafe
+fn get_pws<T>(device: &mut T) -> PasswordSafe
where
T: Device,
{
@@ -42,6 +42,7 @@ where
#[test_device]
fn enable(device: DeviceWrapper) {
+ let mut device = device;
assert_cmd_err!(
CommandError::WrongPassword,
device.get_password_safe(&(USER_PASSWORD.to_owned() + "123"))
@@ -56,8 +57,9 @@ fn enable(device: DeviceWrapper) {
#[test_device]
fn drop(device: DeviceWrapper) {
+ let mut device = device;
{
- let pws = get_pws(&device);
+ let mut pws = get_pws(&mut device);
assert_ok!((), pws.write_slot(1, "name", "login", "password"));
assert_ok!("name".to_string(), pws.get_slot_name(1));
let result = get_slot_name_direct(1);
@@ -72,7 +74,8 @@ fn drop(device: DeviceWrapper) {
#[test_device]
fn get_status(device: DeviceWrapper) {
- let pws = get_pws(&device);
+ let mut device = device;
+ let mut pws = get_pws(&mut device);
for i in 0..SLOT_COUNT {
assert_ok!((), pws.erase_slot(i));
}
@@ -93,7 +96,8 @@ fn get_status(device: DeviceWrapper) {
#[test_device]
fn get_data(device: DeviceWrapper) {
- let pws = get_pws(&device);
+ let mut device = device;
+ let mut pws = get_pws(&mut device);
assert_ok!((), pws.write_slot(1, "name", "login", "password"));
assert_ok!("name".to_string(), pws.get_slot_name(1));
assert_ok!("login".to_string(), pws.get_slot_login(1));
@@ -119,7 +123,8 @@ fn get_data(device: DeviceWrapper) {
#[test_device]
fn write(device: DeviceWrapper) {
- let pws = get_pws(&device);
+ let mut device = device;
+ let mut pws = get_pws(&mut device);
assert_lib_err!(
LibraryError::InvalidSlot,
@@ -144,7 +149,8 @@ fn write(device: DeviceWrapper) {
#[test_device]
fn erase(device: DeviceWrapper) {
- let pws = get_pws(&device);
+ let mut device = device;
+ let mut pws = get_pws(&mut device);
assert_lib_err!(LibraryError::InvalidSlot, pws.erase_slot(SLOT_COUNT));
assert_ok!((), pws.write_slot(0, "name", "login", "password"));