Permalink
Browse files

30DaysOfTests: password retrieval with v2 store

  • Loading branch information...
conradkdotcom committed Aug 19, 2017
1 parent baffb52 commit 55c894042135c5a6df6a104f2fcb162083116cef
Showing with 21 additions and 2 deletions.
  1. +21 −2 src/password/v2.rs
View
@@ -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};
@@ -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.