forked from NationTech/harmony
wip: xml parser
This commit is contained in:
@@ -17,4 +17,4 @@ log = { workspace = true }
|
||||
env_logger = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
cidr = { workspace = true }
|
||||
minidom = { workspace = true }
|
||||
xml_dom = { workspace = true }
|
||||
|
||||
@@ -10,11 +10,12 @@ impl OPNSenseXmlConfigEditor {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use minidom::Element;
|
||||
use std::fs;
|
||||
use std::io::{BufReader, Read};
|
||||
use std::process::Command;
|
||||
|
||||
use xml_dom::parser::read_xml;
|
||||
|
||||
// #[test]
|
||||
// fn should_not_alter_config() {
|
||||
// let path = "./private_repos/affilium_mcd/private/config.xml";
|
||||
@@ -34,10 +35,9 @@ mod test {
|
||||
let file_str = fs::read_to_string(path).expect("Failed to read file");
|
||||
|
||||
// Parse with minidom
|
||||
let root: Element = file_str.parse().unwrap();
|
||||
let root = read_xml(&file_str).unwrap();
|
||||
|
||||
// Save file with suffix name
|
||||
fs::write(&output_path, String::from(&root)).expect("Failed to write output file");
|
||||
assert_eq!(&root.to_string(), &file_str);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user