예제 #1
0
 def test_send_mail_reply_to(self):
     kw = {'reply_to': '*****@*****.**'}
     mail.send_mail('*****@*****.**', '*****@*****.**', 'Subject', 'Body',
                    **kw)
     self.assertEqual(len(_mail.outbox), 1)
     msg = _mail.outbox[0]
     self.assert_('Reply-To' in msg.extra_headers)
     self.assertEqual(msg.extra_headers['Reply-To'], '*****@*****.**')
예제 #2
0
 def test_send_mail(self):
     mail.send_mail('*****@*****.**', '*****@*****.**', 'Subject', 'Body')
     self.assertEqual(len(_mail.outbox), 1)
     msg = _mail.outbox[0]
     self.assertEqual(msg.from_email, '*****@*****.**')
     self.assertEqual(msg.to, ['*****@*****.**'])
     self.assertEqual(msg.subject, 'Subject')
     self.assertEqual(msg.body, 'Body')
예제 #3
0
 def test_send_mail_reply_to(self):
     kw = {'reply_to': '*****@*****.**'}
     mail.send_mail('*****@*****.**', '*****@*****.**',
                    'Subject', 'Body', **kw)
     self.assertEqual(len(_mail.outbox), 1)
     msg = _mail.outbox[0]
     self.assert_('Reply-To' in msg.extra_headers)
     self.assertEqual(msg.extra_headers['Reply-To'], '*****@*****.**')
예제 #4
0
 def test_send_mail_cc(self):
     kw = {'cc': '*****@*****.**'}
     mail.send_mail('*****@*****.**', '*****@*****.**',
                    'Subject', 'Body', **kw)
     self.assertEqual(len(_mail.outbox), 1)
     msg = _mail.outbox[0]
     self.assert_('Cc' in msg.extra_headers)
     self.assertEqual(msg.extra_headers['Cc'], '*****@*****.**')
예제 #5
0
 def test_send_mail_multi_cc(self):
     kw = {'cc': ['*****@*****.**', '*****@*****.**']}
     mail.send_mail('*****@*****.**', '*****@*****.**', 'Subject', 'Body',
                    **kw)
     self.assertEqual(len(_mail.outbox), 1)
     msg = _mail.outbox[0]
     self.assert_('Cc' in msg.extra_headers)
     self.assertEqual(msg.extra_headers['Cc'],
                      '[email protected], [email protected]')
예제 #6
0
 def test_send_mail(self):
     mail.send_mail('*****@*****.**', '*****@*****.**',
                    'Subject', 'Body')
     self.assertEqual(len(_mail.outbox), 1)
     msg = _mail.outbox[0]
     self.assertEqual(msg.from_email, '*****@*****.**')
     self.assertEqual(msg.to, ['*****@*****.**'])
     self.assertEqual(msg.subject, 'Subject')
     self.assertEqual(msg.body, 'Body')
예제 #7
0
 def test_send_mail_keywords(self):
     kw = {'cc' : ['*****@*****.**'],
           'bcc' : ['*****@*****.**'],
           'reply_to' : ['*****@*****.**']}
     headers = {'Cc' : '*****@*****.**',
                'Reply-To' : '*****@*****.**'}
     mail.send_mail('*****@*****.**', '*****@*****.**',
                    'Subject', 'Body', **kw)
     self.assertEqual(len(_mail.outbox), 1)
     msg = _mail.outbox[0]
     self.assertEqual(msg.from_email, '*****@*****.**')
     self.assertEqual(msg.to, ['*****@*****.**'])
     self.assertEqual(msg.subject, 'Subject')
     self.assertEqual(msg.body, 'Body')
     self.assertEqual(msg.extra_headers , headers)
예제 #8
0
 def test_send_mail_cc(self):
     kw = {'cc': '*****@*****.**'}
     mail.send_mail('*****@*****.**', '*****@*****.**', 'Subject', 'Body',
                    **kw)
     self.assertEqual(len(_mail.outbox), 1)
     msg = _mail.outbox[0]
     self.assert_('Cc' in msg.extra_headers)
     self.assertEqual(msg.extra_headers['Cc'], '*****@*****.**')
     msg_str = msg.message().as_string()
     found = False
     for line in msg_str.splitlines():
         if line == 'Cc: [email protected]':
             found = True
             break
     if not found:
         raise AssertionError('Cc header not found in message.')
예제 #9
0
 def test_send_mail_keywords(self):
     kw = {
         'cc': ['*****@*****.**'],
         'bcc': ['*****@*****.**'],
         'reply_to': ['*****@*****.**']
     }
     headers = {'Cc': '*****@*****.**', 'Reply-To': '*****@*****.**'}
     mail.send_mail('*****@*****.**', '*****@*****.**', 'Subject', 'Body',
                    **kw)
     self.assertEqual(len(_mail.outbox), 1)
     msg = _mail.outbox[0]
     self.assertEqual(msg.from_email, '*****@*****.**')
     self.assertEqual(msg.to, ['*****@*****.**'])
     self.assertEqual(msg.subject, 'Subject')
     self.assertEqual(msg.body, 'Body')
     self.assertEqual(msg.extra_headers, headers)
예제 #10
0
 def test_send_mail_cc(self):
     kw = {'cc': '*****@*****.**'}
     mail.send_mail('*****@*****.**', '*****@*****.**',
                    'Subject', 'Body', **kw)
     self.assertEqual(len(_mail.outbox), 1)
     msg = _mail.outbox[0]
     self.assert_('Cc' in msg.extra_headers)
     self.assertEqual(msg.extra_headers['Cc'], '*****@*****.**')
     msg_str = msg.message().as_string()
     found = False
     for line in msg_str.splitlines():
         if line == 'Cc: [email protected]':
             found = True
             break
     if not found:
         raise AssertionError('Cc header not found in message.')