aboutsummaryrefslogtreecommitdiff
path: root/tests/behavior.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-19 14:13:43 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-19 14:13:43 +0100
commit23aa313e11f344da07143d60ce446b5f23d5f362 (patch)
tree7f6c4fec623d0d99d3f09e752a360ca0f806429e /tests/behavior.rs
parent2c5adc8f166c6117ece353376b9071f5e30857b1 (diff)
downloadaerogramme-23aa313e11f344da07143d60ce446b5f23d5f362.tar.gz
aerogramme-23aa313e11f344da07143d60ce446b5f23d5f362.zip
Testing idlefeat/idle
Diffstat (limited to 'tests/behavior.rs')
-rw-r--r--tests/behavior.rs25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/behavior.rs b/tests/behavior.rs
index 699f59d..2e3c610 100644
--- a/tests/behavior.rs
+++ b/tests/behavior.rs
@@ -11,6 +11,7 @@ fn main() {
rfc6851_imapext_move();
rfc7888_imapext_literal();
rfc4551_imapext_condstore();
+ rfc2177_imapext_idle();
println!("โœ… SUCCESS ๐ŸŒŸ๐Ÿš€๐Ÿฅณ๐Ÿ™๐Ÿฅน");
}
@@ -21,8 +22,6 @@ fn rfc3501_imap4rev1_base() {
capability(imap_socket, Extension::None).context("check server capabilities")?;
login(imap_socket, Account::Alice).context("login test")?;
create_mailbox(imap_socket, Mailbox::Archive).context("created mailbox archive")?;
- // UNSUBSCRIBE IS NOT IMPLEMENTED YET
- //unsubscribe_mailbox(imap_socket).context("unsubscribe from archive")?;
let select_res =
select(imap_socket, Mailbox::Inbox, SelectMod::None).context("select inbox")?;
assert!(select_res.contains("* 0 EXISTS"));
@@ -241,3 +240,25 @@ fn rfc4551_imapext_condstore() {
})
.expect("test fully run");
}
+
+
+fn rfc2177_imapext_idle() {
+ println!("๐Ÿงช rfc2177_imapext_idle");
+ common::aerogramme_provider_daemon_dev(|imap_socket, lmtp_socket| {
+ // Test setup
+ connect(imap_socket).context("server says hello")?;
+ capability(imap_socket, Extension::Idle).context("check server capabilities")?;
+ login(imap_socket, Account::Alice).context("login test")?;
+ select(imap_socket, Mailbox::Inbox, SelectMod::None).context("select inbox")?;
+
+ // Check that new messages from LMTP are correctly detected during idling
+ start_idle(imap_socket).context("can't start idling")?;
+ lmtp_handshake(lmtp_socket).context("handshake lmtp done")?;
+ lmtp_deliver_email(lmtp_socket, Email::Basic).context("mail delivered successfully")?;
+ let srv_msg = stop_idle(imap_socket).context("stop idling")?;
+ assert!(srv_msg.contains("* 1 EXISTS"));
+
+ Ok(())
+ })
+ .expect("test fully run");
+}