0
0
mirror of https://github.com/django/django.git synced 2024-11-28 10:48:32 +01:00
django/tests/check_framework/test_async_checks.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
530 B
Python
Raw Normal View History

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])