'Some bots set the referer to the current URL to avoid being blocked by
an referer check (#25302).'

def test_referer_equal_to_requested_url(self):

    self.req.META['HTTP_REFERER'] = self.req.path
    BrokenLinkEmailsMiddleware().process_response(self.req, self.resp)
    self.assertEqual(len(mail.outbox), 0)
    self.req.META['HTTP_REFERER'] = ('http://testserver%s' % self.req.path)
    BrokenLinkEmailsMiddleware().process_response(self.req, self.resp)
    self.assertEqual(len(mail.outbox), 0)
    self.req.META['HTTP_X_PROTO'] = 'https'
    self.req.META['SERVER_PORT'] = 443
    with self.settings(SECURE_PROXY_SSL_HEADER=('HTTP_X_PROTO', 'https')):
        BrokenLinkEmailsMiddleware().process_response(self.req, self.resp)
    self.assertEqual(len(mail.outbox), 0)
