diff options
author | Alexandre Spaeth <Alexerson@users.noreply.github.com> | 2023-02-17 10:35:19 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-02-17 10:48:00 +0100 |
commit | bfb8fda3e69cc6f5c6695ba70117faff51cc25a9 (patch) | |
tree | 58b2dc46a4adbc5952dad9f42f6a2b4757d8d16e /tests/view_tests | |
parent | 8eef22dfed2d53df0da10c0090d9cb04f66efb15 (diff) | |
download | django-bfb8fda3e69cc6f5c6695ba70117faff51cc25a9.tar.gz |
Refs #34342 -- Added tests for handling sync streaming responses by test client.
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
Diffstat (limited to 'tests/view_tests')
-rw-r--r-- | tests/view_tests/tests/test_static.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/view_tests/tests/test_static.py b/tests/view_tests/tests/test_static.py index 3fa382749b..f60ca88cd2 100644 --- a/tests/view_tests/tests/test_static.py +++ b/tests/view_tests/tests/test_static.py @@ -41,9 +41,10 @@ class StaticTests(SimpleTestCase): def test_chunked(self): "The static view should stream files in chunks to avoid large memory usage" response = self.client.get("/%s/%s" % (self.prefix, "long-line.txt")) - first_chunk = next(response.streaming_content) + response_iterator = iter(response) + first_chunk = next(response_iterator) self.assertEqual(len(first_chunk), FileResponse.block_size) - second_chunk = next(response.streaming_content) + second_chunk = next(response_iterator) response.close() # strip() to prevent OS line endings from causing differences self.assertEqual(len(second_chunk.strip()), 1449) |