'The subject is also handled if being passed a request object.'

@override_settings(ADMINS=[('whatever    admin', 'admin@example.com')], EMAIL_SUBJECT_PREFIX='-SuperAwesomeSubject-', INTERNAL_IPS=['127.0.0.1'])
def test_accepts_args_and_request(self):

    message = "Custom    message    that    says    '%s'    and    '%s'"
    token1 = 'ping'
    token2 = 'pong'
    admin_email_handler = self.get_admin_email_handler(self.logger)
    orig_filters = admin_email_handler.filters
    try:
        admin_email_handler.filters = []
        rf = RequestFactory()
        request = rf.get('/')
        self.logger.error(message, token1, token2, extra={'status_code': 403, 'request': request})
        self.assertEqual(len(mail.outbox), 1)
        self.assertEqual(mail.outbox[0].to, ['admin@example.com'])
        self.assertEqual(mail.outbox[0].subject, "-SuperAwesomeSubject-ERROR    (internal    IP):    Custom    message    that    says    'ping'    and    'pong'")
    finally:
        admin_email_handler.filters = orig_filters
