dirceu (owner)

Revisions

gist: 15413 Download_button fork
public
Public Clone URL: git://gist.github.com/15413.git
Embed All Files: show embed
django_outbox_example.py #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from django.test import TestCase
from django.core import mail
from myproject.myapp.views import send_some_emails
 
class FooTestCase(TestCase):
 
    def test_email_subject(self):
        send_some_emails()
        self.assertEquals(mail.outbox[0].subject, 'My subject')
 
    def test_send_some_other_emails(self):
        # it's empty in the beginning of every test
        self.assertTrue(len(mail.outbox) == 0)
        send_some_emails()
        self.assertTrue(len(mail.outbox) > 0)