Skip to content
  • Isis Lovecruft's avatar
    Add utility unittest.TestCase mixin class for testing SMTP. · be223814
    Isis Lovecruft authored
     * ADD a new class, `test_email_server.SMTPTestsMixin`, which has the
       following methods useful for testing SMTP within
       `t.t.unittest.TestCase` subclasses:
    
         - SMTPTestsMixin._buildEmail(fromAddr=None, toAddr=None,
                                      subject=None, body=None)
             Creates email text (including headers) for use in an SMTP DATA
             segment. Includes the SMTP DATA EOM command ('.') at the
             end. If no keyword arguments are given, the defaults are fairly
             sane.
    
         - SMTPTestsMixin._buildSMTP(commands)
             Format a list of SMTP protocol commands into a string, using
             the proper protocol delimiter.
    
         - SMTPTestsMixin._test(commands, expected)
             Send the commands to the TestCase's protocol (this must be the
             `proto` attribute of your `TestCase`), and then check that the
             expected output matches what was received from
             `TestCase.transport` (another attribute you must assign).
    be223814