Add test for dovecot unsolicited OK progress message. (#196)
This commit is contained in:
parent
18ebf56c0c
commit
1db492ed3b
1 changed files with 22 additions and 0 deletions
22
src/parse.rs
22
src/parse.rs
|
|
@ -504,6 +504,28 @@ mod tests {
|
|||
assert_eq!(fetches[0].uid, Some(74));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_fetches_w_dovecot_info() {
|
||||
// Dovecot will sometimes send informational unsolicited
|
||||
// OK messages while performing long operations.
|
||||
// * OK Searched 91% of the mailbox, ETA 0:01
|
||||
let lines = b"\
|
||||
* OK Searched 91% of the mailbox, ETA 0:01\r\n\
|
||||
* 37 FETCH (UID 74)\r\n";
|
||||
let (mut send, recv) = mpsc::channel();
|
||||
let fetches = parse_fetches(lines.to_vec(), &mut send).unwrap();
|
||||
assert_eq!(
|
||||
recv.try_recv(),
|
||||
Ok(UnsolicitedResponse::Ok {
|
||||
code: None,
|
||||
information: Some(String::from("Searched 91% of the mailbox, ETA 0:01")),
|
||||
})
|
||||
);
|
||||
assert_eq!(fetches.len(), 1);
|
||||
assert_eq!(fetches[0].message, 37);
|
||||
assert_eq!(fetches[0].uid, Some(74));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_names_w_unilateral() {
|
||||
let lines = b"\
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue