Fixed tests for git and acme::store

This commit is contained in:
Brian Picciano 2023-08-03 10:02:03 +02:00
parent 337f3c9cef
commit 7f8e40c19f
2 changed files with 10 additions and 4 deletions

View File

@ -166,7 +166,7 @@ impl Store for FSStore {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::domain::acme; use crate::domain::tls;
use tempdir::TempDir; use tempdir::TempDir;
#[test] #[test]
@ -179,7 +179,7 @@ mod tests {
Err::<PrivateKey, GetAccountKeyError>(GetAccountKeyError::NotFound) Err::<PrivateKey, GetAccountKeyError>(GetAccountKeyError::NotFound)
)); ));
let k = acme::PrivateKey::new(); let k = tls::PrivateKey::new();
store.set_account_key(&k).expect("account private key set"); store.set_account_key(&k).expect("account private key set");

View File

@ -379,9 +379,15 @@ mod tests {
}; };
let assert_file_not_empty = |path: &str| { let assert_file_not_empty = |path: &str| {
let f = store.get_file(&descr, path).expect("file not retrieved"); use bytes::BufMut;
let mut f = store.get_file(&descr, path).expect("file not retrieved");
let mut body = bytes::BytesMut::new();
async move { async move {
let body = f.map(|r| r.unwrap()).concat().await; while let Some(chunk) = f.next().await {
body.put(chunk.unwrap())
}
assert!(body.len() > 0); assert!(body.len() > 0);
} }
}; };