diff --git a/src/configure/auto_mozilla.rs b/src/configure/auto_mozilla.rs index 15d53dc41..87920c1c2 100644 --- a/src/configure/auto_mozilla.rs +++ b/src/configure/auto_mozilla.rs @@ -229,3 +229,89 @@ fn moz_autoconfigure_starttag_cb( moz_ac.tag_config = MozConfigTag::Username; } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse_outlook_autoconfig() { + // Copied from https://autoconfig.thunderbird.net/v1.1/outlook.com on 2019-10-11 + let xml_raw = +" + + hotmail.com + hotmail.co.uk + hotmail.co.jp + hotmail.com.br + hotmail.de + hotmail.fr + hotmail.it + hotmail.es + live.com + live.co.uk + live.co.jp + live.de + live.fr + live.it + live.jp + msn.com + outlook.com + Outlook.com (Microsoft) + Outlook + + outlook.office365.com + 443 + %EMAILADDRESS% + SSL + OAuth2 + https://outlook.office365.com/owa/ + https://outlook.office365.com/ews/exchange.asmx + true + + + outlook.office365.com + 993 + SSL + password-cleartext + %EMAILADDRESS% + + + outlook.office365.com + 995 + SSL + password-cleartext + %EMAILADDRESS% + + true + + + + + smtp.office365.com + 587 + STARTTLS + password-cleartext + %EMAILADDRESS% + + + Set up an email app with Outlook.com + + + + + + %EMAILADDRESS% + + + + + +"; + let res = moz_parse_xml("example@outlook.com", xml_raw).expect("XML parsing failed"); + assert_eq!(res.mail_server, "outlook.office365.com"); + assert_eq!(res.mail_port, 993); + assert_eq!(res.send_server, "smtp.office365.com"); + assert_eq!(res.send_port, 587); + } +}