MCPcopy
hub / github.com/django/django / test_untouched_request_body_gets_closed

Method test_untouched_request_body_gets_closed

tests/asgi/tests.py:356–368  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

354 self.assertEqual(outcome, [{"request_body": b"Body data!"}])
355
356 async def test_untouched_request_body_gets_closed(self):
357 application = get_asgi_application()
358 scope = self.async_request_factory._base_scope(method="POST", path="/post/")
359 communicator = ApplicationCommunicator(application, scope)
360 await communicator.send_input({"type": "http.request"})
361 response_start = await communicator.receive_output()
362 self.assertEqual(response_start["type"], "http.response.start")
363 self.assertEqual(response_start["status"], 204)
364 response_body = await communicator.receive_output()
365 self.assertEqual(response_body["type"], "http.response.body")
366 self.assertEqual(response_body["body"], b"")
367 # Allow response.close() to finish
368 await communicator.wait()
369
370 async def test_get_query_string(self):
371 application = get_asgi_application()

Callers

nothing calls this directly

Calls 2

get_asgi_applicationFunction · 0.90
_base_scopeMethod · 0.80

Tested by

no test coverage detected