Skip to content

Commit

Permalink
30DaysOfTests: password retrieval with v2 store
Browse files Browse the repository at this point in the history
  • Loading branch information
conradkleinespel committed Aug 19, 2017
1 parent baffb52 commit 55c8940
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/password/v2.rs
Expand Up @@ -21,8 +21,7 @@ use byteorder::{ReadBytesExt, WriteBytesExt, BigEndian};
use serde_json;
use safe_string::SafeString;
use safe_vec::SafeVec;

use super::PasswordError;
use password::PasswordError;
use serde_json::Error;
use std::io::{Seek, SeekFrom, Result as IoResult, Error as IoError, ErrorKind as IoErrorKind,
Read, Write, Cursor};
Expand Down Expand Up @@ -633,4 +632,24 @@ mod test {
assert!(store.get_password("name2").is_none());
assert_eq!(store.get_all_passwords().len(), 0);
}

#[test]
fn test_get_password() {
let mut store = PasswordStore::new("****").unwrap();

assert_eq!(store.get_password("name"), None);
assert!(
store
.add_password(Password::new("name", "username", "password"))
.is_ok()
);
assert_eq!(
store.get_password("name").unwrap(),
Password::new("name", "username", "password")
);
assert_eq!(
store.get_password("NaMe").unwrap(),
Password::new("name", "username", "password")
);
}
}

0 comments on commit 55c8940

Please sign in to comment.