@@ -712,6 +712,42 @@ fn winsw_xml() -> &'static str {
|
||||
</service>"#
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn current_singbox_recognizes_the_native_installer_xml() {
|
||||
let xml = proxywarden_lib::singbox_service::singbox_service_xml();
|
||||
for xml in [
|
||||
xml.to_owned(),
|
||||
xml.replace(""", """),
|
||||
xml.replace(""", """),
|
||||
] {
|
||||
let inventory = inventory_singbox_with_host(¤t_singbox_host_with_xml(&xml));
|
||||
assert_eq!(
|
||||
inventory.classification(),
|
||||
ComponentClassification::ManagedCurrent
|
||||
);
|
||||
}
|
||||
for entity in ["&unknown;", "&quot;", "�", "�"] {
|
||||
let xml = xml.replace(""", entity);
|
||||
let inventory = inventory_singbox_with_host(¤t_singbox_host_with_xml(&xml));
|
||||
assert_ne!(
|
||||
inventory.classification(),
|
||||
ComponentClassification::ManagedCurrent
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
#[ignore = "read-only smoke test requiring an installed managed sing-box"]
|
||||
fn installed_singbox_inventory_is_current() {
|
||||
let inventory = proxywarden_lib::component_detection::inventory_singbox();
|
||||
assert_eq!(
|
||||
inventory.classification(),
|
||||
ComponentClassification::ManagedCurrent,
|
||||
"{inventory:?}"
|
||||
);
|
||||
}
|
||||
|
||||
fn current_singbox_host_with_xml(xml: &str) -> MockHost {
|
||||
MockHost::new()
|
||||
.with_path(r"C:\Program Files\ProxyWarden\components\sing-box\sing-box.exe")
|
||||
|
||||
Reference in New Issue
Block a user