test db open newness

feat/vaults
Tomáš Mládek 2021-12-23 11:11:36 +01:00
parent ce9e552844
commit 0058a9fcdd
No known key found for this signature in database
GPG Key ID: ED21612889E75EC5
1 changed files with 14 additions and 1 deletions

View File

@ -327,7 +327,20 @@ mod test {
#[test]
fn test_open() {
let result = UpEndDatabase::open(TempDir::new("upend-test").unwrap(), None, false);
let tempdir = TempDir::new("upend-test").unwrap();
let result = UpEndDatabase::open(&tempdir, None, false);
assert!(result.is_ok());
assert!(result.unwrap().new);
// Not new
let result = UpEndDatabase::open(&tempdir, None, false);
assert!(result.is_ok());
assert!(!result.unwrap().new);
// reinitialize true, new again
let result = UpEndDatabase::open(&tempdir, None, true);
assert!(result.is_ok());
assert!(result.unwrap().new);
}
}