'Ensure that the subject is also handled if being
passed a request object.'

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

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