1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +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, modify_settings,
override_settings, override_settings,
) )
from django.test.utils import captured_stderr
from django.urls import path from django.urls import path
from django.utils.http import http_date from django.utils.http import http_date
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
@ -95,6 +96,7 @@ class ASGITest(SimpleTestCase):
with open(test_filename, "rb") as test_file: with open(test_filename, "rb") as test_file:
test_file_contents = test_file.read() test_file_contents = test_file.read()
# Read the response. # Read the response.
with captured_stderr():
response_start = await communicator.receive_output() response_start = await communicator.receive_output()
self.assertEqual(response_start["type"], "http.response.start") self.assertEqual(response_start["type"], "http.response.start")
self.assertEqual(response_start["status"], 200) self.assertEqual(response_start["status"], 200)