Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes
test_sendmail.TestEncodeAddress Class Reference

List of all members.

Public Member Functions

def testSimpleAddress
def testComposite
def testCompositeUnicode
def testEmptyPhrase
def testEmptyAddress
def testInvalidAddress

Static Public Attributes

tuple charset = Charset(config.charset)

Detailed Description

Address encoding tests

See http://www.faqs.org/rfcs/rfc2822.html section 3.4.
Address Specification.

mailbox     =   name-addr / addr-spec
name-addr   =   [display-name] angle-addr
angle-addr  =   [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr

Definition at line 69 of file test_sendmail.py.


Member Function Documentation

mail.sendmail: encode address: 'Phrase <local@domain>' 

Definition at line 89 of file test_sendmail.py.

00089 
00090     def testComposite(self):
00091         """ mail.sendmail: encode address: 'Phrase <local@domain>' """
00092         address = u'Phrase <local@domain>'
00093         expected = str(address)
00094         assert sendmail.encodeAddress(address, self.charset) == expected

mail.sendmail: encode Uncode address: 'ויקי <local@domain>' 

Definition at line 95 of file test_sendmail.py.

00095 
00096     def testCompositeUnicode(self):
00097         """ mail.sendmail: encode Uncode address: 'ויקי <local@domain>' """
00098         address = u'ויקי <local@domain>'
00099         phrase = str(Header(u'ויקי'.encode('utf-8'), self.charset))
00100         expected = phrase + ' ' + '<local@domain>'
00101         assert sendmail.encodeAddress(address, self.charset) == expected

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.

Definition at line 108 of file test_sendmail.py.

00108 
00109     def testEmptyAddress(self):
00110         """ mail.sendmail: encode address with empty address: 'Phrase <>'
00111 
00112         Let the smtp server handle this. We may raise error in such
00113         case, but we don't do error checking for mail addresses.
00114         """
00115         address = u'Phrase <>'
00116         expected = str(address)
00117         assert sendmail.encodeAddress(address, self.charset) == expected

mail.sendmail: encode address with empty phrase: '<local@domain>' 

Definition at line 102 of file test_sendmail.py.

00102 
00103     def testEmptyPhrase(self):
00104         """ mail.sendmail: encode address with empty phrase: '<local@domain>' """
00105         address = u'<local@domain>'
00106         expected = 'local@domain'
00107         assert sendmail.encodeAddress(address, self.charset) == expected

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.

Definition at line 118 of file test_sendmail.py.

00118 
00119     def testInvalidAddress(self):
00120         """ mail.sendmail: encode invalid address 'Phrase <blah'
00121 
00122         Assume that this is a simple address. This address will
00123         probably cause an error when trying to send mail. Junk in, junk
00124         out.
00125         """
00126         address = u'Phrase <blah'
00127         expected = str(address)
00128         assert sendmail.encodeAddress(address, self.charset) == expected

mail.sendmail: encode simple address: local@domain 

Definition at line 83 of file test_sendmail.py.

00083 
00084     def testSimpleAddress(self):
00085         """ mail.sendmail: encode simple address: local@domain """
00086         address = u'local@domain'
00087         expected = address.encode(config.charset)
00088         assert sendmail.encodeAddress(address, self.charset) == expected


Member Data Documentation

tuple test_sendmail.TestEncodeAddress.charset = Charset(config.charset) [static]

Definition at line 79 of file test_sendmail.py.


The documentation for this class was generated from the following file: