Beispiel #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'], '*****@*****.**')
Beispiel #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')
 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'], '*****@*****.**')
 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'], '*****@*****.**')
Beispiel #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]')
 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')
 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)
Beispiel #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.')
Beispiel #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)
 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.')