use crate::helpers::{new_message, TestInfoBuilder, DEFAULT_BODY, DEFAULT_RECIPIENT}; use lettre::{transport::smtp::client::Tls, Transport}; use maik::MailAssertion; #[test] fn basic() { let test_info = TestInfoBuilder::new().default_auth_user().build(); let mailer = test_info.mailer_builder.tls(Tls::None).build(); let message = new_message(DEFAULT_RECIPIENT, DEFAULT_BODY); assert!(mailer.send(&message).is_ok()); let ma = MailAssertion::new().body_is(DEFAULT_BODY); assert!(test_info.server.assert(ma)); } #[test] fn forbidden_sequence() { let test_info = TestInfoBuilder::new().default_auth_user().build(); let mailer = test_info.mailer_builder.tls(Tls::None).build(); let body = "hai hai\r\n.\r\nnana"; let message = new_message(DEFAULT_RECIPIENT, body); assert!(mailer.send(&message).is_ok()); let ma = MailAssertion::new().body_is(body); assert!(test_info.server.assert(ma)); } #[test] fn lines_starting_with_period() { let test_info = TestInfoBuilder::new().default_auth_user().build(); let mailer = test_info.mailer_builder.tls(Tls::None).build(); let body = "hai hai\r\n.nana\r\n."; let message = new_message(DEFAULT_RECIPIENT, body); assert!(mailer.send(&message).is_ok()); let ma = MailAssertion::new().body_is(body); assert!(test_info.server.assert(ma)); }