summaryrefslogtreecommitdiff
path: root/tests/view_tests
diff options
context:
space:
mode:
authorAlexandre Spaeth <Alexerson@users.noreply.github.com>2023-02-17 10:35:19 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-02-17 10:48:00 +0100
commitbfb8fda3e69cc6f5c6695ba70117faff51cc25a9 (patch)
tree58b2dc46a4adbc5952dad9f42f6a2b4757d8d16e /tests/view_tests
parent8eef22dfed2d53df0da10c0090d9cb04f66efb15 (diff)
downloaddjango-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.py5
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)