use super::super::defs::*;
use super::extract_highest_modseq;
#[test]
fn condstore_enable() {
let setup = set_up();
let mut client = setup.connect("7162cece");
quick_log_in(&mut client);
quick_create(&mut client, "7162cece");
quick_append_enron(&mut client, "7162cece", 3);
assert_enabled_by(&setup, "SELECT 7162cece (CONDSTORE)");
assert_enabled_by(&setup, "EXAMINE 7162cece (CONDSTORE)");
assert_enabled_by(&setup, "STATUS INBOX (HIGHESTMODSEQ)");
assert_enabled_by(&setup, "FETCH 1:* MODSEQ");
assert_enabled_by(&setup, "SEARCH MODSEQ 0");
assert_enabled_by(&setup, "FETCH 1:* UID (CHANGEDSINCE 0)");
assert_enabled_by(
&setup,
"STORE 1:* (UNCHANGEDSINCE 0) \
-FLAGS.SILENT (keyword)",
);
assert_enabled_by(&setup, "ENABLE CONDSTORE");
}
fn assert_enabled_by(setup: &Setup, command: &'static str) {
let mut client = setup.connect("7162cece");
quick_log_in(&mut client);
quick_select(&mut client, "7162cece");
command!(responses = client, c(command));
has_untagged_response_matching! {
s::Response::Cond(s::CondResponse {
code: Some(s::RespTextCode::HighestModseq(_)),
..
}) in responses
};
command!(responses = client, c("EXAMINE 7162cece"));
has_untagged_response_matching! {
s::Response::Cond(s::CondResponse {
code: Some(s::RespTextCode::HighestModseq(_)),
..
}) in responses
};
}
#[test]
fn enable_primordial() {
let setup = set_up();
let mut client = setup.connect("7162cesp");
quick_log_in(&mut client);
quick_create(&mut client, "7162cesp");
quick_select(&mut client, "7162cesp");
command!(mut responses = client, c("ENABLE CONDSTORE"));
assert_tagged_ok_any(responses.pop().unwrap());
assert_eq!(1, extract_highest_modseq(&responses));
}