feat: sync all in encrypt decrypt test

This commit is contained in:
Sebastian Pravda 2022-10-29 11:27:32 +02:00
parent 96be1f4d83
commit 433e45e315
No known key found for this signature in database
GPG key ID: F3BC84F08EFA3F57

View file

@ -403,12 +403,14 @@ mod tests {
let mut encrypted_file = async_tempfile::TempFile::new().await.unwrap();
tokio::io::AsyncWriteExt::write_all(&mut plain_file, PASSWORD.as_bytes()).await.unwrap();
encrypted_file.sync_all().await.unwrap();
assert_eq!(tokio::fs::read_to_string(&plain_file.file_path()).await.unwrap(), PASSWORD);
super::encrypt_file_with_recipients(&plain_file.file_path(), &encrypted_file.file_path(), vec![PUBLIC_KEY])
.await
.unwrap();
encrypted_file.sync_all().await.unwrap();
let mut buffer = [0; 21];
@ -421,6 +423,7 @@ mod tests {
super::decrypt_file_with_private_key(&encrypted_file.file_path(), &decrypted_file.file_path(), PRIVATE_KEY)
.await
.unwrap();
decrypted_file.sync_all().await.unwrap();
assert_eq!(tokio::fs::read_to_string(&decrypted_file.file_path()).await.unwrap(), PASSWORD);
}