mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #31380 -- Added deployment system check for DJANGO_ALLOW_ASYNC_UNSAFE environment variable.
This commit is contained in:
parent
e9b014fbc5
commit
4a6f2b63d7
5 changed files with 49 additions and 0 deletions
15
tests/check_framework/test_async_checks.py
Normal file
15
tests/check_framework/test_async_checks.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import os
|
||||
from unittest import mock
|
||||
|
||||
from django.core.checks.async_checks import E001, check_async_unsafe
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
|
||||
class AsyncCheckTests(SimpleTestCase):
|
||||
@mock.patch.dict(os.environ, {'DJANGO_ALLOW_ASYNC_UNSAFE': ''})
|
||||
def test_no_allowed_async_unsafe(self):
|
||||
self.assertEqual(check_async_unsafe(None), [])
|
||||
|
||||
@mock.patch.dict(os.environ, {'DJANGO_ALLOW_ASYNC_UNSAFE': 'true'})
|
||||
def test_allowed_async_unsafe_set(self):
|
||||
self.assertEqual(check_async_unsafe(None), [E001])
|
Loading…
Add table
Add a link
Reference in a new issue