summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2024-04-05 09:06:06 +0200
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-04-05 11:30:33 +0200
commit4d2ef9bb826db76acb5ed7609a9162de9b651921 (patch)
treed687fd3a7761d75e734dfc3df4c8bc2095cf6557
parentba4ffdc8771c2f38cf6de26a2b82bbceea2b933a (diff)
Refs #35169 -- Added test for ASGIRequest root_path handling.
-rw-r--r--tests/handlers/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py
index 7a5a287da7..959e4737d2 100644
--- a/tests/handlers/tests.py
+++ b/tests/handlers/tests.py
@@ -326,6 +326,15 @@ class AsyncHandlerRequestTests(SimpleTestCase):
with self.assertRaisesMessage(ValueError, msg):
await self.async_client.get("/unawaited/")
+ def test_root_path(self):
+ async_request_factory = AsyncRequestFactory()
+ request = async_request_factory.request(
+ **{"path": "/root/somepath/", "root_path": "/root"}
+ )
+ self.assertEqual(request.path, "/root/somepath/")
+ self.assertEqual(request.script_name, "/root")
+ self.assertEqual(request.path_info, "/somepath/")
+
@override_settings(FORCE_SCRIPT_NAME="/FORCED_PREFIX/")
def test_force_script_name(self):
async_request_factory = AsyncRequestFactory()