1
0
mirror of https://github.com/django/django.git synced 2025-01-03 15:06:09 +00:00

Fixed the testcases and some orientation #35414

This commit is contained in:
YashRaj1506 2024-12-08 00:43:39 +05:30
parent 136f617275
commit 8912820541
3 changed files with 5 additions and 6 deletions

View File

@ -1251,16 +1251,14 @@ class AsyncClientTest(TestCase):
)
self.assertEqual(response.asgi_request.GET["example"], "data")
async def async_header_defaults(
self,
) -> None:
async def test_async_header_defaults(self):
async_client = AsyncClient(HTTP_AUTHORIZATION="Bearer I_AM_JWT_TOKEN")
response = await async_client.get(
"/async_default_headers/",
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, b'{"message": "This is a trial view"}')
@override_settings(ROOT_URLCONF="test_client.urls")

View File

@ -83,7 +83,7 @@ urlpatterns = [
# Async views.
path("async_get_view/", views.async_get_view, name="async_get_view"),
path(
"async_default_headers",
"async_default_headers/",
views.async_default_headers,
name="async_default_headers",
),

View File

@ -13,6 +13,7 @@ from django.http import (
HttpResponseNotAllowed,
HttpResponseNotFound,
HttpResponseRedirect,
JsonResponse,
)
from django.shortcuts import render
from django.template import Context, Template
@ -436,4 +437,4 @@ class CBView(TemplateView):
def async_default_headers(request):
data = {"message": "This is a trial view"}
return HttpResponse(data)
return JsonResponse(data)