Fixed #24139 -- Changed HttpResponse.reason_phrase to evaluate based on status_code.

This commit is contained in:
Jon Dufresne 2015-01-12 14:45:09 -08:00 committed by Tim Graham
parent 7f8588d22e
commit d861f95c44
4 changed files with 43 additions and 6 deletions

View file

@ -54,6 +54,12 @@ class HttpResponseTests(SimpleTestCase):
self.assertEqual(resp.status_code, 503)
self.assertEqual(resp.reason_phrase, "Service Unavailable")
def test_change_status_code(self):
resp = HttpResponse()
resp.status_code = 503
self.assertEqual(resp.status_code, 503)
self.assertEqual(resp.reason_phrase, "Service Unavailable")
def test_reason_phrase(self):
reason = "I'm an anarchist coffee pot on crack."
resp = HttpResponse(status=814, reason=reason)