summaryrefslogtreecommitdiff
path: root/tests/check_framework
diff options
context:
space:
mode:
Diffstat (limited to 'tests/check_framework')
-rw-r--r--tests/check_framework/test_async_checks.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/check_framework/test_async_checks.py b/tests/check_framework/test_async_checks.py
new file mode 100644
index 0000000000..fa7f840172
--- /dev/null
+++ b/tests/check_framework/test_async_checks.py
@@ -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])