From 1e85abd10cca63a7426eec56d1ed9d639c96437e Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 20 Dec 2018 20:58:13 +0100 Subject: [PATCH] sasl: Add test failure_with_non_prefixed_text_lang. --- src/sasl.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/sasl.rs b/src/sasl.rs index 05dd250a..86e10760 100644 --- a/src/sasl.rs +++ b/src/sasl.rs @@ -288,4 +288,20 @@ mod tests { String::from("Call 212-555-1212 for assistance.") ); } + + #[test] + fn failure_with_non_prefixed_text_lang() { + let elem: Element = " + + Invalid username or password + " + .parse() + .unwrap(); + let failure = Failure::try_from(elem).unwrap(); + assert_eq!(failure.defined_condition, DefinedCondition::NotAuthorized); + assert_eq!( + failure.texts["en"], + String::from("Invalid username or password") + ); + } }