1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

Refs #33735 -- Captured stderr during ASGITest.test_file_response.

This commit is contained in:
Jacob Walls 2024-11-23 16:43:38 -05:00 committed by Sarah Boyce
parent c635decb00
commit a5bc0cfd35

View File

@ -21,6 +21,7 @@ from django.test import (
modify_settings,
override_settings,
)
from django.test.utils import captured_stderr
from django.urls import path
from django.utils.http import http_date
from django.views.decorators.csrf import csrf_exempt
@ -95,7 +96,8 @@ class ASGITest(SimpleTestCase):
with open(test_filename, "rb") as test_file:
test_file_contents = test_file.read()
# Read the response.
response_start = await communicator.receive_output()
with captured_stderr():
response_start = await communicator.receive_output()
self.assertEqual(response_start["type"], "http.response.start")
self.assertEqual(response_start["status"], 200)
headers = response_start["headers"]