示例#1
0
 def testNoRecipient(self):
     info = {
         'sender': '*****@*****.**',
         'recipients': '',
         'cc': ['*****@*****.**'],
         'bcc': '[email protected],[email protected]',
         'subject': 'Τεστ test',
         'body': 'This is a τεστ on utf8'
     }
     with self.assertRaises(ValueError):
         message = Message(**info)
示例#2
0
 def testInvalidSender(self):
     invalid = ['a', 'a@', '@.', '@a.', '.@', 'a@@', 'a@@.']
     for sender in invalid:
         info = {
             'sender': sender,
             'recipients': '*****@*****.**',
             'subject': 'Τεστ test',
             'body': 'This is a τεστ on utf8'
         }
         with self.assertRaises(ValueError):
             message = Message(**info)
示例#3
0
 def testValid(self):
     info = {
         'sender': '*****@*****.**',
         'recipients': '*****@*****.**',
         'cc': ['*****@*****.**'],
         'bcc': '[email protected],[email protected]',
         'subject': 'Τεστ test',
         'body': 'This is a τεστ on utf8'
     }
     message = Message(**info)
     self.assertTrue(message.subject == u'Τεστ test')
     self.assertTrue(message.body == u'This is a τεστ on utf8')
示例#4
0
 def testInvalidBCC(self):
     invalid = [
         'a', 'a@', '@.', '@a.', '.@', 'a@@', 'a@@.', '[email protected],a.',
         'inv.domain.com,[email protected]'
     ]
     for bcc in invalid:
         info = {
             'sender': '*****@*****.**',
             'recipients': '*****@*****.**',
             'bcc': bcc,
             'subject': 'Τεστ test',
             'body': 'This is a τεστ on utf8'
         }
         with self.assertRaises(ValueError):
             message = Message(**info)
示例#5
0
 def testRecipients(self):
     info = {
         'sender': '*****@*****.**',
         'recipients': '*****@*****.**',
         'cc': ['*****@*****.**'],
         'bcc': '[email protected],[email protected]',
         'subject': 'Τεστ test',
         'body': 'This is a τεστ on utf8',
         'content': 'html'
     }
     message = Message(**info)
     self.assertTrue(message.recipients == [
         '*****@*****.**', '*****@*****.**', '*****@*****.**',
         '*****@*****.**'
     ])