Skip to content

Instantly share code, notes, and snippets.

@dirceu
Created October 7, 2008 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dirceu/15413 to your computer and use it in GitHub Desktop.
Save dirceu/15413 to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment