PageRenderTime 125ms CodeModel.GetById 61ms app.highlight 5ms RepoModel.GetById 55ms app.codeStats 1ms

/tests/regressiontests/mail/custombackend.py

https://code.google.com/p/mango-py/
Python | 15 lines | 8 code | 5 blank | 2 comment | 0 complexity | 60f2cfaa65c97b6002fc370ca18251b9 MD5 | raw file
 1"""A custom backend for testing."""
 2
 3from django.core.mail.backends.base import BaseEmailBackend
 4
 5
 6class 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)