1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #30509 -- Adjusted FileResponse test to close file earlier.

This commit is contained in:
Piotr Kunicki
2021-10-14 14:44:35 +02:00
committed by Carlton Gibson
parent dc724c5bf9
commit cb8d7ca0ba

View File

@@ -188,8 +188,9 @@ class FileResponseTests(SimpleTestCase):
pipe_for_write.write(b'binary content')
response = FileResponse(os.fdopen(pipe_for_read, mode='rb'))
self.assertEqual(list(response), [b'binary content'])
response_content = list(response)
response.close()
self.assertEqual(response_content, [b'binary content'])
self.assertFalse(response.has_header('Content-Length'))
def test_compressed_response(self):