44 lines
1.3 KiB
Rust
44 lines
1.3 KiB
Rust
use crate::executors::ExecutorError;
|
|
|
|
pub struct OPNSenseXmlConfigEditor;
|
|
|
|
impl OPNSenseXmlConfigEditor {
|
|
pub(crate) async fn add(vec: Vec<&str>, xml_entry: &str) -> Result<(), ExecutorError>{
|
|
todo!()
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod test {
|
|
use minidom::Element;
|
|
use std::fs;
|
|
use std::io::{BufReader, Read};
|
|
use std::process::Command;
|
|
|
|
// #[test]
|
|
// fn should_not_alter_config() {
|
|
// let path = "./private_repos/affilium_mcd/private/config.xml";
|
|
// // TODO
|
|
// // Load file to string
|
|
// // Parse with minidom (ex: `let root: Element = file_str.parse().unwrap()`)
|
|
// // save file with suffix name
|
|
// // Verify that file is still identical with md5sum after removing indentation
|
|
// }
|
|
|
|
#[test]
|
|
fn should_not_alter_config() {
|
|
let path = "/home/jeangab/work/nationtech/harmony/harmony-rs/affilium_mcd/private/config.xml";
|
|
let output_path = format!("{}.test_output", path);
|
|
|
|
// Load file to string
|
|
let file_str = fs::read_to_string(path).expect("Failed to read file");
|
|
|
|
// Parse with minidom
|
|
let root: Element = file_str.parse().unwrap();
|
|
|
|
// Save file with suffix name
|
|
fs::write(&output_path, String::from(&root)).expect("Failed to write output file");
|
|
}
|
|
|
|
}
|