Adding capability tests

This commit is contained in:
Matt McCoy 2016-06-21 23:16:03 -04:00
parent 8e99f80dca
commit 2aa66be25d

View file

@ -485,6 +485,18 @@ mod tests {
assert!(mailbox == expected_mailbox, "Unexpected mailbox returned");
}
#[test]
fn capability() {
let response = b"* CAPABILITY IMAP4rev1 STARTTLS AUTH=GSSAPI LOGINDISABLED\r\n\
a1 OK CAPABILITY completed\r\n".to_vec();
let expected_capabilities = vec!["IMAP4rev1", "STARTTLS", "AUTH=GSSAPI", "LOGINDISABLED"];
let mock_stream = MockStream::new(response);
let mut client = create_client_with_mock_stream(mock_stream);
let capabilities = client.capability().unwrap();
assert!(client.stream.written_buf == b"a1 CAPABILITY\r\n".to_vec(), "Invalid capability command");
assert!(capabilities == expected_capabilities, "Unexpected capabilities response");
}
#[test]
fn create() {
// TODO Make sure the response was read correctly