'Test that the console backend can be pointed at an arbitrary stream.'

def test_console_stream_kwarg(self):

    s = StringIO()
    connection = mail.get_connection(u'django.core.mail.backends.console.EmailBackend', stream=s)
    send_mail(u'Subject', u'Content', u'from@example.com', [u'to@example.com'], connection=connection)
    message = force_bytes(s.getvalue().split(((u'\n' + (u'-' * 79)) + u'\n'))[0])
    self.assertMessageHasHeaders(message, set(((u'MIME-Version', u'1.0'), (u'Content-Type', u'text/plain;    charset="utf-8"'), (u'Content-Transfer-Encoding', u'7bit'), (u'Subject', u'Subject'), (u'From', u'from@example.com'), (u'To', u'to@example.com'))))
    self.assertIn('\nDate:    ', message)
