aboutsummaryrefslogtreecommitdiff
path: root/tests/behavior.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/behavior.rs')
-rw-r--r--tests/behavior.rs56
1 files changed, 52 insertions, 4 deletions
diff --git a/tests/behavior.rs b/tests/behavior.rs
index 0447d80..7fdd553 100644
--- a/tests/behavior.rs
+++ b/tests/behavior.rs
@@ -6,13 +6,14 @@ use crate::common::fragments::*;
fn main() {
rfc3501_imap4rev1_base();
- rfc3691_imapext_unselect();
- rfc5161_imapext_enable();
rfc6851_imapext_move();
- rfc7888_imapext_literal();
rfc4551_imapext_condstore();
rfc2177_imapext_idle();
- rfc4315_imapext_uidplus();
+ rfc5161_imapext_enable(); // 1
+ rfc3691_imapext_unselect(); // 2
+ rfc7888_imapext_literal(); // 3
+ rfc4315_imapext_uidplus(); // 4
+ rfc5819_imapext_liststatus(); // 5
println!("โœ… SUCCESS ๐ŸŒŸ๐Ÿš€๐Ÿฅณ๐Ÿ™๐Ÿฅน");
}
@@ -307,3 +308,50 @@ fn rfc4315_imapext_uidplus() {
})
.expect("test fully run");
}
+
+///
+/// Example
+///
+/// ```text
+/// 30 list "" "*" RETURN (STATUS (MESSAGES UNSEEN))
+/// * LIST (\Subscribed) "." INBOX
+/// * STATUS INBOX (MESSAGES 2 UNSEEN 1)
+/// 30 OK LIST completed
+/// ```
+fn rfc5819_imapext_liststatus() {
+ println!("๐Ÿงช rfc5819_imapext_liststatus");
+ common::aerogramme_provider_daemon_dev(|imap_socket, lmtp_socket| {
+ // Test setup, check capability, add 2 emails, read 1
+ connect(imap_socket).context("server says hello")?;
+ capability(imap_socket, Extension::ListStatus).context("check server capabilities")?;
+ login(imap_socket, Account::Alice).context("login test")?;
+ select(imap_socket, Mailbox::Inbox, SelectMod::None).context("select inbox")?;
+ lmtp_handshake(lmtp_socket).context("handshake lmtp done")?;
+ lmtp_deliver_email(lmtp_socket, Email::Basic).context("mail delivered successfully")?;
+ lmtp_deliver_email(lmtp_socket, Email::Multipart).context("mail delivered successfully")?;
+ noop_exists(imap_socket, 2).context("noop loop must detect a new email")?;
+ fetch(
+ imap_socket,
+ Selection::FirstId,
+ FetchKind::Rfc822,
+ FetchMod::None,
+ )
+ .context("read one message")?;
+ close(imap_socket).context("close inbox")?;
+
+ // Test return status MESSAGES UNSEEN
+ let ret = list(
+ imap_socket,
+ MbxSelect::All,
+ ListReturn::StatusMessagesUnseen,
+ )?;
+ assert!(ret.contains("* STATUS INBOX (MESSAGES 2 UNSEEN 1)"));
+
+ // Test that without RETURN, no status is sent
+ let ret = list(imap_socket, MbxSelect::All, ListReturn::None)?;
+ assert!(!ret.contains("* STATUS"));
+
+ Ok(())
+ })
+ .expect("test fully run");
+}