Use Message struct in write_to_test_path()

Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
This commit is contained in:
Jacob Kiers 2022-08-02 23:17:59 +02:00
parent 02be91a75d
commit 96a9c27fc0
1 changed files with 8 additions and 5 deletions

View File

@ -103,15 +103,18 @@ fn process_html(input: &str) -> Result<String, sanitize_html::errors::SanitizeEr
//Ok(input.to_owned())
}
fn write_to_test_path(uid: &str, message: &[u8]) {
let test_path: PathBuf = [Path::new("tests/data"), Path::new(&format!("{}.eml", &uid))]
.iter()
.collect();
fn write_to_test_path(msg: &Message) {
let test_path: PathBuf = [
Path::new("tests/data"),
Path::new(&format!("{}.eml", &msg.get_uid())),
]
.iter()
.collect();
let _ = OpenOptions::new()
.write(true)
.create(true)
.open(test_path)
.expect("Could not open file fir writing")
.write_all(&message);
.write_all(&msg.data);
}