Skip to content

Add test for dovecot unsolicited OK progress message. #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"\
Expand Down