From fc0fa72ff4cdbf5861a366e31cb8bbacd44da22d Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Wed, 12 Feb 2020 15:15:00 -0700 Subject: Fixed #31224 -- Added support for asynchronous views and middleware. This implements support for asynchronous views, asynchronous tests, asynchronous middleware, and an asynchronous test client. --- django/test/testcases.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'django/test/testcases.py') diff --git a/django/test/testcases.py b/django/test/testcases.py index 2c24708a3b..7ebddf80e5 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -33,7 +33,7 @@ from django.db import DEFAULT_DB_ALIAS, connection, connections, transaction from django.forms.fields import CharField from django.http import QueryDict from django.http.request import split_domain_port, validate_host -from django.test.client import Client +from django.test.client import AsyncClient, Client from django.test.html import HTMLParseError, parse_html from django.test.signals import setting_changed, template_rendered from django.test.utils import ( @@ -151,6 +151,7 @@ class SimpleTestCase(unittest.TestCase): # The class we'll use for the test client self.client. # Can be overridden in derived classes. client_class = Client + async_client_class = AsyncClient _overridden_settings = None _modified_settings = None @@ -292,6 +293,7 @@ class SimpleTestCase(unittest.TestCase): * Clear the mail test outbox. """ self.client = self.client_class() + self.async_client = self.async_client_class() mail.outbox = [] def _post_teardown(self): -- cgit v1.3