'RFC 2822\'s hard limit is 998 characters per line.
So, minus "Subject: ", the actual subject must be no longer than 989
characters.
Refs #17281.'

@override_settings(ADMINS=((u'admin', u'admin@example.com'),), EMAIL_SUBJECT_PREFIX=u'', DEBUG=False)
def test_truncate_subject(self):

    message = (u'a' * 1000)
    expected_subject = (u'ERROR:    aa' + (u'a' * 980))
    self.assertEqual(len(mail.outbox), 0)
    self.logger.error(message)
    self.assertEqual(len(mail.outbox), 1)
    self.assertEqual(mail.outbox[0].subject, expected_subject)
