parts/django/tests/regressiontests/mail/custombackend.py
changeset 307 c6bca38c1cbf
equal deleted inserted replaced
306:5ff1fc726848 307:c6bca38c1cbf
       
     1 """A custom backend for testing."""
       
     2 
       
     3 from django.core.mail.backends.base import BaseEmailBackend
       
     4 
       
     5 
       
     6 class EmailBackend(BaseEmailBackend):
       
     7 
       
     8     def __init__(self, *args, **kwargs):
       
     9         super(EmailBackend, self).__init__(*args, **kwargs)
       
    10         self.test_outbox = []
       
    11 
       
    12     def send_messages(self, email_messages):
       
    13         # Messages are stored in a instance variable for testing.
       
    14         self.test_outbox.extend(email_messages)
       
    15         return len(email_messages)