Adding FETCH test

This commit is contained in:
Matt McCoy 2016-06-21 20:28:59 -04:00
parent 6dd23c4647
commit 50a55d59c4

View file

@ -417,6 +417,19 @@ mod tests {
assert!(client.stream.written_buf == command.as_bytes().to_vec(), "Invalid rename command"); assert!(client.stream.written_buf == command.as_bytes().to_vec(), "Invalid rename command");
} }
#[test]
fn fetch() {
// TODO Make sure the response was read correctly
let response = b"a1 OK FETCH completed\r\n".to_vec();
let sequence_set = "1";
let query = "BODY[]";
let command = format!("a1 FETCH {} {}\r\n", sequence_set, query);
let mock_stream = MockStream::new(response);
let mut client = create_client_with_mock_stream(mock_stream);
client.fetch(sequence_set, query).unwrap();
assert!(client.stream.written_buf == command.as_bytes().to_vec(), "Invalid fetch command");
}
#[test] #[test]
fn subscribe() { fn subscribe() {
// TODO Make sure the response was read correctly // TODO Make sure the response was read correctly