mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #34394 -- Added FORCE_SCRIPT_NAME handling to ASGIRequest.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
parent
c3d7a71f83
commit
041b0a359a
2 changed files with 18 additions and 10 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue