Advertisement
Guest User

Untitled

a guest
Oct 31st, 2018
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # (c) 2018 CeleraOne GmbH
  3. *** Settings ***
  4. Documentation Acceptance tests for the SMTP Mock server.
  5. Default Tags mock_smtp
  6.  
  7. Resource smtp_kwords.robot
  8. Library smtp_utils.py
  9.  
  10. Suite Setup Start SMTP Server
  11. Suite Teardown Stop SMTP Server
  12.  
  13. *** Variables ***
  14. ${EMAIL_1}= recipient@celeraone.com
  15. ${EMAIL_2}= recipient2@celeraone.com
  16.  
  17. *** Test Cases ***
  18. MOCK SMTP: Mailboxes are added dynamically
  19. [Documentation] Test that mailboxes are created on the fly by the server,
  20. ... as soon as a message for an email address, which does not
  21. ... yet have a mailbox set up for it, is caught.
  22.  
  23. ${message}= build message
  24. ... from_=sender@celeraone.com
  25. ... to=${EMAIL_1}
  26. ... subject=My Subject Line
  27. ... body=Hello there!
  28.  
  29. # Send a few mails to fill the recipient's mailbox.
  30. Send Email ${message}
  31. Send Email ${message}
  32. Send Email ${message}
  33.  
  34. # Check that the message did, in fact, end up in the SMTP Server's mailbox
  35. # named after the "to" field's string.
  36. Assert Mailbox for ${EMAIL_1} Has 3 Messages
  37.  
  38. ${message}= build message
  39. ... from_=sender@celeraone.com
  40. ... to=${EMAIL_2}
  41. ... subject=My Subject Line
  42. ... body=Goodbye!
  43.  
  44. # Assert that emails are in fact sorted correctly and do not end up in
  45. # other email addresses's mailboxes.
  46. Assert Mailbox for ${EMAIL_1} Has 3 Messages
  47. Assert Mailbox for ${EMAIL_2} Has 1 Messages
  48. assert mailbox contains message message=${message} mailbox=${EMAIL_2}
  49.  
  50.  
  51. MOCK_SMTP: Mailboxes can be reset using keywords
  52. [Documentation] Test that the mailbox for a given email address can be
  53. ... reset, deleting any message that were previously stored
  54. ... in it.
  55.  
  56. # Send a few mails to fill the recipient's mailbox and assert they arrived.
  57. ${message}= build message
  58. ... from_=sender@celeraone.com
  59. ... to=${EMAIL_1}
  60. ... subject=My Subject Line
  61. ... body=Hello there!
  62.  
  63. Send Email ${message}
  64. Send Email ${message}
  65. Send Email ${message}
  66.  
  67. Assert Mailbox for ${EMAIL_1} Has 3 Messages
  68. Assert Mailbox for ${EMAIL_2} Has 0 Messages
  69.  
  70. # Send a few more messages to another inbox and assert they arrived.
  71. ${message}= build message
  72. ... from_=sender@celeraone.com
  73. ... to=${EMAIL_2}
  74. ... subject=My Subject Line
  75. ... body=Hello there!
  76. Send Email ${message}
  77. Send Email ${message}
  78. Assert Mailbox for ${EMAIL_1} Has 3 Messages
  79. Assert Mailbox for ${EMAIL_2} Has 2 Messages
  80.  
  81. # Reset recipient@celeraone.com's mailbox and assert it affected only their
  82. # mailbox on the SMTP server.
  83. reset mailbox mailbox=${EMAIL_1}
  84. Assert Mailbox for ${EMAIL_1} Has 0 Messages
  85. Assert Mailbox for ${EMAIL_2} Has 2 Messages
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement