mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #31380 -- Added deployment system check for DJANGO_ALLOW_ASYNC_UNSAFE environment variable.
This commit is contained in:
committed by
Mariusz Felisiak
parent
e9b014fbc5
commit
4a6f2b63d7
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])
|
||||
Reference in New Issue
Block a user