From 735ba9562a565a7fcd94ae281df84914356c134d Mon Sep 17 00:00:00 2001 From: Matt McCoy Date: Tue, 21 Jun 2016 20:06:37 -0400 Subject: [PATCH] Adding test for RENAME command --- src/client.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/client.rs b/src/client.rs index 0c804ef..19d325a 100644 --- a/src/client.rs +++ b/src/client.rs @@ -380,6 +380,19 @@ mod tests { assert!(command2 == expected_command2, "expected command doesn't equal actual command"); } + #[test] + fn rename() { + // TODO Make sure the response was read correctly + let response = b"a1 OK RENAME completed\r\n".to_vec(); + let current_mailbox_name = "INBOX"; + let new_mailbox_name = "NEWINBOX"; + let command = format!("a1 RENAME {} {}\r\n", current_mailbox_name, new_mailbox_name); + let mock_stream = MockStream::new(response); + let mut client = create_client_with_mock_stream(mock_stream); + client.rename(current_mailbox_name, new_mailbox_name).unwrap(); + assert!(client.stream.written_buf == command.as_bytes().to_vec(), "Invalid rename command"); + } + #[test] fn subscribe() { // TODO Make sure the response was read correctly