예제 #1
0
    def testEmptyAddress(self):
        """ mail.sendmail: encode address with empty address: 'Phrase <>'

        Let the smtp server handle this. We may raise error in such
        case, but we don't do error checking for mail addresses.
        """
        address = u'Phrase <>'
        expected = str(address)
        assert sendmail.encodeAddress(address, self.charset) == expected
예제 #2
0
    def testInvalidAddress(self):
        """ mail.sendmail: encode invalid address 'Phrase <blah'

        Assume that this is a simple address. This address will
        probably cause an error when trying to send mail. Junk in, junk
        out.
        """
        address = u'Phrase <blah'
        expected = str(address)
        assert sendmail.encodeAddress(address, self.charset) == expected
예제 #3
0
 def testCompositeUnicode(self):
     """ mail.sendmail: encode Uncode address: 'ויקי <local@domain>' """
     address = u'ויקי <local@domain>'
     phrase = str(Header(u'ויקי'.encode('utf-8'), self.charset))
     expected = phrase + ' ' + '<local@domain>'
     assert sendmail.encodeAddress(address, self.charset) == expected
예제 #4
0
 def testComposite(self):
     """ mail.sendmail: encode address: 'Phrase <local@domain>' """
     address = u'Phrase <local@domain>'
     expected = str(address)
     assert sendmail.encodeAddress(address, self.charset) == expected
예제 #5
0
 def testSimpleAddress(self):
     """ mail.sendmail: encode simple address: local@domain """
     address = u'local@domain'
     expected = address.encode(CHARSET)
     assert sendmail.encodeAddress(address, self.charset) == expected
예제 #6
0
 def testEmptyPhrase(self):
     """ mail.sendmail: encode address with empty phrase: '<local@domain>' """
     address = u'<local@domain>'
     expected = 'local@domain'
     assert sendmail.encodeAddress(address, self.charset) == expected