Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # (c) 2018 CeleraOne GmbH
- *** Settings ***
- Documentation Acceptance tests for the SMTP Mock server.
- Default Tags mock_smtp
- Resource smtp_kwords.robot
- Library smtp_utils.py
- Suite Setup Start SMTP Server
- Suite Teardown Stop SMTP Server
- *** Variables ***
- ${EMAIL_1}= recipient@celeraone.com
- ${EMAIL_2}= recipient2@celeraone.com
- *** Test Cases ***
- MOCK SMTP: Mailboxes are added dynamically
- [Documentation] Test that mailboxes are created on the fly by the server,
- ... as soon as a message for an email address, which does not
- ... yet have a mailbox set up for it, is caught.
- ${message}= build message
- ... from_=sender@celeraone.com
- ... to=${EMAIL_1}
- ... subject=My Subject Line
- ... body=Hello there!
- # Send a few mails to fill the recipient's mailbox.
- Send Email ${message}
- Send Email ${message}
- Send Email ${message}
- # Check that the message did, in fact, end up in the SMTP Server's mailbox
- # named after the "to" field's string.
- Assert Mailbox for ${EMAIL_1} Has 3 Messages
- ${message}= build message
- ... from_=sender@celeraone.com
- ... to=${EMAIL_2}
- ... subject=My Subject Line
- ... body=Goodbye!
- # Assert that emails are in fact sorted correctly and do not end up in
- # other email addresses's mailboxes.
- Assert Mailbox for ${EMAIL_1} Has 3 Messages
- Assert Mailbox for ${EMAIL_2} Has 1 Messages
- assert mailbox contains message message=${message} mailbox=${EMAIL_2}
- MOCK_SMTP: Mailboxes can be reset using keywords
- [Documentation] Test that the mailbox for a given email address can be
- ... reset, deleting any message that were previously stored
- ... in it.
- # Send a few mails to fill the recipient's mailbox and assert they arrived.
- ${message}= build message
- ... from_=sender@celeraone.com
- ... to=${EMAIL_1}
- ... subject=My Subject Line
- ... body=Hello there!
- Send Email ${message}
- Send Email ${message}
- Send Email ${message}
- Assert Mailbox for ${EMAIL_1} Has 3 Messages
- Assert Mailbox for ${EMAIL_2} Has 0 Messages
- # Send a few more messages to another inbox and assert they arrived.
- ${message}= build message
- ... from_=sender@celeraone.com
- ... to=${EMAIL_2}
- ... subject=My Subject Line
- ... body=Hello there!
- Send Email ${message}
- Send Email ${message}
- Assert Mailbox for ${EMAIL_1} Has 3 Messages
- Assert Mailbox for ${EMAIL_2} Has 2 Messages
- # Reset recipient@celeraone.com's mailbox and assert it affected only their
- # mailbox on the SMTP server.
- reset mailbox mailbox=${EMAIL_1}
- Assert Mailbox for ${EMAIL_1} Has 0 Messages
- Assert Mailbox for ${EMAIL_2} Has 2 Messages
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement