mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Bug in 0bd2c0c901.
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
This commit is contained in:
committed by
Mariusz Felisiak
parent
bfb8fda3e6
commit
52b054824e
@@ -253,6 +253,16 @@ class HandlerRequestTests(SimpleTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(b"".join(list(response)), b"streaming content")
|
||||
|
||||
def test_async_streaming(self):
|
||||
response = self.client.get("/async_streaming/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
msg = (
|
||||
"StreamingHttpResponse must consume asynchronous iterators in order to "
|
||||
"serve them synchronously. Use a synchronous iterator instead."
|
||||
)
|
||||
with self.assertWarnsMessage(Warning, msg):
|
||||
self.assertEqual(b"".join(list(response)), b"streaming content")
|
||||
|
||||
|
||||
class ScriptNameTests(SimpleTestCase):
|
||||
def test_get_script_name(self):
|
||||
@@ -329,3 +339,10 @@ class AsyncHandlerRequestTests(SimpleTestCase):
|
||||
self.assertEqual(
|
||||
b"".join([chunk async for chunk in response]), b"streaming content"
|
||||
)
|
||||
|
||||
async def test_async_streaming(self):
|
||||
response = await self.async_client.get("/async_streaming/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(
|
||||
b"".join([chunk async for chunk in response]), b"streaming content"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user