mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #25099 -- Fixed crash in AdminEmailHandler on DisallowedHost.
This commit is contained in:
committed by
Tim Graham
parent
4c0447b2ae
commit
cf29b6b561
@@ -439,6 +439,14 @@ class ExceptionReporterTests(SimpleTestCase):
|
||||
"Evaluation exception reason not mentioned in traceback"
|
||||
)
|
||||
|
||||
@override_settings(ALLOWED_HOSTS='example.com')
|
||||
def test_disallowed_host(self):
|
||||
"An exception report can be generated even for a disallowed host."
|
||||
request = self.rf.get('/', HTTP_HOST='evil.com')
|
||||
reporter = ExceptionReporter(request, None, None, None)
|
||||
html = reporter.get_traceback_html()
|
||||
self.assertIn("http://evil.com/", html)
|
||||
|
||||
|
||||
class PlainTextReportTests(SimpleTestCase):
|
||||
rf = RequestFactory()
|
||||
@@ -495,6 +503,14 @@ class PlainTextReportTests(SimpleTestCase):
|
||||
reporter = ExceptionReporter(None, None, "I'm a little teapot", None)
|
||||
reporter.get_traceback_text()
|
||||
|
||||
@override_settings(ALLOWED_HOSTS='example.com')
|
||||
def test_disallowed_host(self):
|
||||
"An exception report can be generated even for a disallowed host."
|
||||
request = self.rf.get('/', HTTP_HOST='evil.com')
|
||||
reporter = ExceptionReporter(request, None, None, None)
|
||||
text = reporter.get_traceback_text()
|
||||
self.assertIn("http://evil.com/", text)
|
||||
|
||||
|
||||
class ExceptionReportTestMixin(object):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user