summaryrefslogtreecommitdiff
path: root/tests/test_client/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_client/tests.py')
-rw-r--r--tests/test_client/tests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index 57dc22ea0c..5612ae4462 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -1103,6 +1103,14 @@ class AsyncClientTest(TestCase):
response = await self.async_client.get("/get_view/", {"var": "val"})
self.assertContains(response, "This is a test. val is the value.")
+ async def test_post_data(self):
+ response = await self.async_client.post("/post_view/", {"value": 37})
+ self.assertContains(response, "Data received: 37 is the value.")
+
+ async def test_body_read_on_get_data(self):
+ response = await self.async_client.get("/post_view/")
+ self.assertContains(response, "Viewing GET page.")
+
@override_settings(ROOT_URLCONF="test_client.urls")
class AsyncRequestFactoryTest(SimpleTestCase):
@@ -1147,6 +1155,16 @@ class AsyncRequestFactoryTest(SimpleTestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, b'{"example": "data"}')
+ async def test_request_limited_read(self):
+ tests = ["GET", "POST"]
+ for method in tests:
+ with self.subTest(method=method):
+ request = self.request_factory.generic(
+ method,
+ "/somewhere",
+ )
+ self.assertEqual(request.read(200), b"")
+
def test_request_factory_sets_headers(self):
request = self.request_factory.get(
"/somewhere/",