diff options
| author | sarahboyce <sarahvboyce95@gmail.com> | 2023-04-10 17:10:43 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-04-12 12:50:48 +0200 |
| commit | 041b0a359a0a80e147b47c6ae5f11bca9dd3b28a (patch) | |
| tree | 239347ecfaedc36c406764e123f8c58415771c5e /tests/handlers | |
| parent | c3d7a71f836f7cfe8fa90dd9ae95b37b660d5aae (diff) | |
Fixed #34394 -- Added FORCE_SCRIPT_NAME handling to ASGIRequest.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'tests/handlers')
| -rw-r--r-- | tests/handlers/tests.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py index 0348b8e5d6..ab3837d25e 100644 --- a/tests/handlers/tests.py +++ b/tests/handlers/tests.py @@ -3,6 +3,7 @@ from django.core.handlers.wsgi import WSGIHandler, WSGIRequest, get_script_name from django.core.signals import request_finished, request_started from django.db import close_old_connections, connection from django.test import ( + AsyncRequestFactory, RequestFactory, SimpleTestCase, TransactionTestCase, @@ -328,6 +329,12 @@ class AsyncHandlerRequestTests(SimpleTestCase): with self.assertRaisesMessage(ValueError, msg): await self.async_client.get("/unawaited/") + @override_settings(FORCE_SCRIPT_NAME="/FORCED_PREFIX/") + def test_force_script_name(self): + async_request_factory = AsyncRequestFactory() + request = async_request_factory.request(**{"path": "/somepath/"}) + self.assertEqual(request.path, "/FORCED_PREFIX/somepath/") + async def test_sync_streaming(self): response = await self.async_client.get("/streaming/") self.assertEqual(response.status_code, 200) |
