Skip to content

Commit b774c59

Browse files
committed
Fixed django#19172 -- Isolated poisoned_http_host tests from 500 handlers
Thanks bernardofontes for the report.
1 parent 4c4d085 commit b774c59

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

django/contrib/auth/tests/views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def test_admin_reset(self):
115115
self.assertTrue("http://adminsite.com" in mail.outbox[0].body)
116116
self.assertEqual(settings.DEFAULT_FROM_EMAIL, mail.outbox[0].from_email)
117117

118+
# Skip any 500 handler action (like sending more mail...)
119+
@override_settings(DEBUG_PROPAGATE_EXCEPTIONS=True)
118120
def test_poisoned_http_host(self):
119121
"Poisoned HTTP_HOST headers can't be used for reset emails"
120122
# This attack is based on the way browsers handle URLs. The colon
@@ -131,6 +133,8 @@ def test_poisoned_http_host(self):
131133
)
132134
self.assertEqual(len(mail.outbox), 0)
133135

136+
# Skip any 500 handler action (like sending more mail...)
137+
@override_settings(DEBUG_PROPAGATE_EXCEPTIONS=True)
134138
def test_poisoned_http_host_admin_site(self):
135139
"Poisoned HTTP_HOST headers can't be used for reset emails on admin views"
136140
with self.assertRaises(SuspiciousOperation):

0 commit comments

Comments
 (0)