pub struct MailAssertion { /* private fields */ }
Expand description
An assertion object for testing the mails sent on a MockServer. See MockServer::assert for calling the MailAssertion.
§Examples
Assert user@domain.tld
sent something.
let ma = maik::MailAssertion::new().sender_is("user@domain.tld");
Assert user@domain.tld
sent Hi,\r\n\r\nBye!
to
at least user1@domain.tld
and user2@domain.tld
.
let mut recipients = std::collections::HashSet::new();
recipients.insert("user1@domain.tld");
recipients.insert("user2@domain.tld");
let ma = maik::MailAssertion::new()
.sender_is("user@domain.tld")
.recipients_contain(recipients)
.body_is("Hi,\r\n\r\nBye!");
Assert user@domain.tld
received an email that contains “verification code: “.
let mut recipients = std::collections::HashSet::new();
recipients.insert("user@domain.tld");
let ma = maik::MailAssertion::new()
.recipients_are(recipients)
.body_contains("verification code: ");
Implementations§
Source§impl MailAssertion
impl MailAssertion
Sourcepub fn recipients_are(self, users: HashSet<&str>) -> Self
pub fn recipients_are(self, users: HashSet<&str>) -> Self
Asserts that the recipients equal to the given users.
Sourcepub fn recipients_contain(self, users: HashSet<&str>) -> Self
pub fn recipients_contain(self, users: HashSet<&str>) -> Self
Asserts that the recipients contain the given users.
Sourcepub fn body_contains(self, text: &str) -> Self
pub fn body_contains(self, text: &str) -> Self
Asserts that the body contains the given text.
Auto Trait Implementations§
impl Freeze for MailAssertion
impl RefUnwindSafe for MailAssertion
impl Send for MailAssertion
impl Sync for MailAssertion
impl Unpin for MailAssertion
impl UnwindSafe for MailAssertion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more