sasl: Add test failure_with_non_prefixed_text_lang.

This commit is contained in:
Astro 2018-12-20 20:58:13 +01:00
parent 96c8b05677
commit 1e85abd10c

View file

@ -288,4 +288,20 @@ mod tests {
String::from("Call 212-555-1212 for assistance.") String::from("Call 212-555-1212 for assistance.")
); );
} }
#[test]
fn failure_with_non_prefixed_text_lang() {
let elem: Element = "<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-sasl' lang='en'>Invalid username or password</text>
</failure>"
.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")
);
}
} }